vesant-sdk 2.0.0-dev.76771da → 2.0.0-dev.9578c07
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/{client-CIEa7xYG.d.mts → client-BwkGrRW9.d.mts} +1 -1
- package/dist/{client-BJ87_Vv5.d.ts → client-CqSx0lAG.d.ts} +3 -3
- package/dist/{client-IAOGCBfm.d.mts → client-Dq0NMaXT.d.mts} +3 -3
- package/dist/{client-Bvp-f05-.d.ts → client-DvobLmsc.d.ts} +1 -1
- package/dist/compliance/index.d.mts +4 -4
- package/dist/compliance/index.d.ts +4 -4
- package/dist/decisions/index.d.mts +1 -1
- package/dist/decisions/index.d.ts +1 -1
- package/dist/geolocation/index.d.mts +3 -3
- package/dist/geolocation/index.d.ts +3 -3
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +54 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -10
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +3 -3
- package/dist/kyc/core.d.ts +3 -3
- package/dist/kyc/core.js +54 -10
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +54 -10
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +253 -21
- package/dist/kyc/index.d.ts +253 -21
- package/dist/kyc/index.js +54 -10
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +54 -10
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +41 -6
- package/dist/react.d.ts +41 -6
- package/dist/react.js +603 -272
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +603 -272
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +3 -3
- package/dist/risk-profile/index.d.ts +3 -3
- package/dist/scores/index.d.mts +1 -1
- package/dist/scores/index.d.ts +1 -1
- package/dist/{types-C4Zx0d_u.d.mts → types-BOFaMQxI.d.mts} +1 -1
- package/dist/{types-QUCWam16.d.mts → types-CBQRNL-l.d.mts} +10 -3
- package/dist/{types-QUCWam16.d.ts → types-CBQRNL-l.d.ts} +10 -3
- package/dist/{types-2utj53GK.d.ts → types-UGyDl1fd.d.ts} +1 -1
- package/dist/webhooks/index.d.mts +12 -4
- package/dist/webhooks/index.d.ts +12 -4
- package/package.json +1 -1
package/dist/kyc/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/core/errors.ts","../../src/core/circuit-breaker.ts","../../src/core/rate-limiter.ts","../../src/core/logger.ts","../../src/core/version.ts","../../src/shared/browser-utils.ts","../../src/core/client.ts","../../src/kyc/client.ts","../../src/kyc/types.ts"],"names":[],"mappings":";AAOO,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoB,KAAA,CAAM;AAAA,EAGrC,WAAA,CACE,OAAA,EACO,IAAA,EACA,UAAA,EACA,OAAA,EACP;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAJN,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGP,IAAA,IAAA,CAAK,IAAA,GAAO,aAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,YAAA,CAAY,SAAS,CAAA;AAAA,EACnD;AACF,CAAA;AAOO,IAAM,YAAA,GAAN,MAAM,aAAA,SAAqB,WAAA,CAAY;AAAA,EAC5C,WAAA,CAAY,SAAwB,aAAA,EAAyB;AAC3D,IAAA,KAAA,CAAM,SAAS,eAAe,CAAA;AADI,IAAA,IAAA,CAAA,aAAA,GAAA,aAAA;AAElC,IAAA,IAAA,CAAK,IAAA,GAAO,cAAA;AACZ,IAAA,MAAA,CAAO,cAAA,CAAe,IAAA,EAAM,aAAA,CAAa,SAAS,CAAA;AAAA,EACpD;AACF,CAAA;AAEO,IAAM,eAAA,GAAN,MAAM,gBAAA,S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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,mBAAmB,SAAA,EAA6C;AACpE,IAAA,OAAO,IAAA,CAAK,kBAAA;AAAA,MACV,mCAAmC,SAAS,CAAA;AAAA,KAC9C;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BA,MAAM,sBACJ,OAAA,EAC0B;AAC1B,IAAA,OAAO,IAAA,CAAK,mBAAoC,kBAAA,EAAoB;AAAA,MAClE,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAO;AAAA,KAC7B,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAKF;;;ACnrBO,IAAM,yBAAA,GAA6D;AAAA,EACxE,oBAAA,EAAsB,oCAAA;AAAA,EACtB,oBAAA,EAAsB,8CAAA;AAAA,EACtB,iBAAA,EAAmB,uDAAA;AAAA,EACnB,mBAAA,EAAqB,yBAAA;AAAA,EACrB,sBAAA,EAAwB,+DAAA;AAAA,EACxB,oBAAA,EAAsB,6BAAA;AAAA,EACtB,iBAAA,EAAmB,qDAAA;AAAA,EACnB,qBAAA,EAAuB,iEAAA;AAAA,EACvB,YAAA,EAAc;AAChB","file":"index.mjs","sourcesContent":["/**\n * Error hierarchy for Vesant SDK\n *\n * Provides structured error handling with specific error types\n * for different failure scenarios.\n */\n\nexport class VesantError extends Error {\n public requestId?: string;\n\n constructor(\n message: string,\n public code: string,\n public statusCode?: number,\n public details?: Record<string, unknown>\n ) {\n super(message);\n this.name = 'VesantError';\n Object.setPrototypeOf(this, VesantError.prototype);\n }\n}\n\n/** @deprecated Use VesantError instead */\nexport const CGSError = VesantError;\n/** @deprecated Use VesantError instead */\nexport type CGSError = VesantError;\n\nexport class NetworkError extends VesantError {\n constructor(message: string, public originalError?: unknown) {\n super(message, 'NETWORK_ERROR');\n this.name = 'NetworkError';\n Object.setPrototypeOf(this, NetworkError.prototype);\n }\n}\n\nexport class ValidationError extends VesantError {\n constructor(message: string, fields?: string[]) {\n super(message, 'VALIDATION_ERROR', 400, { fields });\n this.name = 'ValidationError';\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport class ServiceUnavailableError extends VesantError {\n constructor(message: string = 'Service unavailable') {\n super(message, 'SERVICE_UNAVAILABLE', 503);\n this.name = 'ServiceUnavailableError';\n Object.setPrototypeOf(this, ServiceUnavailableError.prototype);\n }\n}\n\nexport class ComplianceBlockedError extends VesantError {\n constructor(reasons: import('./types').BlockReason[]) {\n super('Access blocked due to compliance rules', 'COMPLIANCE_BLOCKED', 403, { reasons });\n this.name = 'ComplianceBlockedError';\n Object.setPrototypeOf(this, ComplianceBlockedError.prototype);\n }\n}\n\nexport class AuthenticationError extends VesantError {\n constructor(message: string = 'Authentication failed') {\n super(message, 'AUTHENTICATION_ERROR', 401);\n this.name = 'AuthenticationError';\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\nexport class RateLimitError extends VesantError {\n constructor(public retryAfter?: number) {\n super('Rate limit exceeded', 'RATE_LIMIT_EXCEEDED', 429, { retryAfter });\n this.name = 'RateLimitError';\n Object.setPrototypeOf(this, RateLimitError.prototype);\n }\n}\n\nexport class TimeoutError extends VesantError {\n constructor(public timeout: number) {\n super(`Request timeout after ${timeout}ms`, 'TIMEOUT', 408, { timeout });\n this.name = 'TimeoutError';\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\nexport class ComplianceError extends VesantError {\n constructor(\n message: string,\n public originalError?: unknown,\n code: string = 'COMPLIANCE_ERROR'\n ) {\n super(message, code);\n this.name = 'ComplianceError';\n Object.setPrototypeOf(this, ComplianceError.prototype);\n }\n}\n\nexport class CircuitBreakerOpenError extends VesantError {\n constructor() {\n super('Circuit breaker is open — requests are temporarily blocked', 'CIRCUIT_BREAKER_OPEN', 503);\n this.name = 'CircuitBreakerOpenError';\n Object.setPrototypeOf(this, CircuitBreakerOpenError.prototype);\n }\n}\n","/**\n * Circuit breaker pattern for resilient HTTP requests.\n *\n * States: closed (normal) -> open (failing) -> half-open (testing) -> closed\n */\n\nexport type CircuitBreakerState = 'closed' | 'open' | 'half-open';\n\nexport interface CircuitBreakerConfig {\n /** Number of consecutive failures before opening the circuit (default: 5) */\n failureThreshold?: number;\n /** Time in ms to wait before transitioning from open to half-open (default: 30000) */\n resetTimeout?: number;\n /** Number of successes in half-open state before closing (default: 1) */\n successThreshold?: number;\n}\n\nexport interface CircuitBreakerStatus {\n state: CircuitBreakerState;\n failures: number;\n successes: number;\n lastFailureTime: number | null;\n nextRetryTime: number | null;\n}\n\nexport class CircuitBreaker {\n private state: CircuitBreakerState = 'closed';\n private failures = 0;\n private successes = 0;\n private lastFailureTime: number | null = null;\n\n private readonly failureThreshold: number;\n private readonly resetTimeout: number;\n private readonly successThreshold: number;\n\n constructor(config: CircuitBreakerConfig = {}) {\n this.failureThreshold = config.failureThreshold ?? 5;\n this.resetTimeout = config.resetTimeout ?? 30000;\n this.successThreshold = config.successThreshold ?? 1;\n }\n\n /**\n * Check if a request can proceed through the circuit breaker.\n */\n canExecute(): boolean {\n if (this.state === 'closed') {\n return true;\n }\n\n if (this.state === 'open') {\n const now = Date.now();\n if (this.lastFailureTime && now - this.lastFailureTime >= this.resetTimeout) {\n this.state = 'half-open';\n this.successes = 0;\n return true;\n }\n return false;\n }\n\n // half-open: allow requests through for testing\n return true;\n }\n\n /**\n * Record a successful request.\n */\n onSuccess(): void {\n if (this.state === 'half-open') {\n this.successes++;\n if (this.successes >= this.successThreshold) {\n this.state = 'closed';\n this.failures = 0;\n this.successes = 0;\n this.lastFailureTime = null;\n }\n } else if (this.state === 'closed') {\n this.failures = 0;\n }\n }\n\n /**\n * Record a failed request.\n */\n onFailure(): void {\n this.failures++;\n this.lastFailureTime = Date.now();\n\n if (this.state === 'half-open') {\n this.state = 'open';\n this.successes = 0;\n } else if (this.state === 'closed' && this.failures >= this.failureThreshold) {\n this.state = 'open';\n }\n }\n\n /**\n * Get current circuit breaker status.\n */\n getStatus(): CircuitBreakerStatus {\n return {\n state: this.state,\n failures: this.failures,\n successes: this.successes,\n lastFailureTime: this.lastFailureTime,\n nextRetryTime:\n this.state === 'open' && this.lastFailureTime\n ? this.lastFailureTime + this.resetTimeout\n : null,\n };\n }\n\n /**\n * Reset the circuit breaker to its initial closed state.\n */\n reset(): void {\n this.state = 'closed';\n this.failures = 0;\n this.successes = 0;\n this.lastFailureTime = null;\n }\n}\n","/**\n * Rate limit tracking from API response headers.\n *\n * Tracks X-RateLimit-* headers to enable pre-flight checks\n * before making requests.\n */\n\nexport interface RateLimitStatus {\n /** Maximum requests allowed in the window */\n limit: number | null;\n /** Remaining requests in the current window */\n remaining: number | null;\n /** Unix timestamp (seconds) when the rate limit resets */\n reset: number | null;\n /** Seconds until the rate limit resets */\n retryAfter: number | null;\n}\n\nexport class RateLimitTracker {\n private limit: number | null = null;\n private remaining: number | null = null;\n private reset: number | null = null;\n private retryAfter: number | null = null;\n\n /**\n * Extract rate limit information from response headers.\n */\n updateFromHeaders(headers: Headers): void {\n const limit = headers.get('x-ratelimit-limit');\n const remaining = headers.get('x-ratelimit-remaining');\n const reset = headers.get('x-ratelimit-reset');\n const retryAfter = headers.get('retry-after');\n\n if (limit !== null) this.limit = parseInt(limit, 10);\n if (remaining !== null) this.remaining = parseInt(remaining, 10);\n if (reset !== null) this.reset = parseInt(reset, 10);\n if (retryAfter !== null) this.retryAfter = parseInt(retryAfter, 10);\n }\n\n /**\n * Check if the rate limit has been exceeded based on tracked headers.\n */\n isLimitExceeded(): boolean {\n if (this.remaining !== null && this.remaining <= 0) {\n // Check if the reset time has passed\n if (this.reset !== null) {\n const now = Math.floor(Date.now() / 1000);\n if (now >= this.reset) {\n // Reset window has passed, allow requests\n this.remaining = null;\n this.reset = null;\n this.retryAfter = null;\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Get current rate limit status.\n */\n getStatus(): RateLimitStatus {\n return {\n limit: this.limit,\n remaining: this.remaining,\n reset: this.reset,\n retryAfter: this.retryAfter,\n };\n }\n}\n","import type { Logger } from './config';\n\nexport function createConsoleLogger(): Logger {\n return {\n debug(message: string, meta?: Record<string, unknown>) {\n console.log(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n info(message: string, meta?: Record<string, unknown>) {\n console.info(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n warn(message: string, meta?: Record<string, unknown>) {\n console.warn(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n error(message: string, meta?: Record<string, unknown>) {\n console.error(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n };\n}\n\nexport const noopLogger: Logger = {\n debug() {},\n info() {},\n warn() {},\n error() {},\n};\n","/**\n * Single source of truth for the SDK version.\n */\nexport const SDK_VERSION = '2.0.0';\n","/**\n * Shared browser utility functions.\n *\n * Extracted from ciphertext.ts and hooks.ts to avoid duplication.\n * All functions include SSR guards for safe server-side rendering.\n */\n\n/**\n * Generate a UUID v4\n */\nexport function generateUUID(): string {\n if (typeof crypto !== 'undefined' && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n\n // Fallback for older browsers\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Generate a unique device ID that persists across sessions.\n * Falls back to a random UUID when localStorage is unavailable (SSR).\n */\nexport function generateDeviceId(): string {\n if (typeof window === 'undefined' || typeof localStorage === 'undefined') {\n return generateUUID();\n }\n\n const storageKey = 'vesant_device_id';\n let deviceId = localStorage.getItem(storageKey);\n\n if (!deviceId) {\n deviceId = generateUUID();\n localStorage.setItem(storageKey, deviceId);\n }\n\n return deviceId;\n}\n\n/**\n * Detect browser information from user agent.\n * Returns safe defaults when running server-side.\n */\nexport function getBrowserInfo(): {\n browser: string;\n browser_version: string;\n os: string;\n os_version: string;\n} {\n if (typeof navigator === 'undefined') {\n return { browser: 'unknown', browser_version: '', os: 'unknown', os_version: '' };\n }\n\n const ua = navigator.userAgent;\n let browser = 'unknown';\n let browserVersion = '';\n let os = 'unknown';\n let osVersion = '';\n\n // Detect browser\n if (ua.includes('Firefox/')) {\n browser = 'Firefox';\n browserVersion = ua.match(/Firefox\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Edg/')) {\n browser = 'Edge';\n browserVersion = ua.match(/Edg\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Chrome/')) {\n browser = 'Chrome';\n browserVersion = ua.match(/Chrome\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Safari/') && !ua.includes('Chrome')) {\n browser = 'Safari';\n browserVersion = ua.match(/Version\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Opera') || ua.includes('OPR/')) {\n browser = 'Opera';\n browserVersion = ua.match(/(?:Opera|OPR)\\/([\\d.]+)/)?.[1] || '';\n }\n\n // Detect OS\n if (ua.includes('Windows')) {\n os = 'Windows';\n if (ua.includes('Windows NT 10.0')) osVersion = '10';\n else if (ua.includes('Windows NT 6.3')) osVersion = '8.1';\n else if (ua.includes('Windows NT 6.2')) osVersion = '8';\n else if (ua.includes('Windows NT 6.1')) osVersion = '7';\n } else if (ua.includes('Mac OS X')) {\n os = 'macOS';\n osVersion = ua.match(/Mac OS X ([\\d_]+)/)?.[1]?.replace(/_/g, '.') || '';\n } else if (ua.includes('Linux')) {\n os = 'Linux';\n } else if (ua.includes('Android')) {\n os = 'Android';\n osVersion = ua.match(/Android ([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('iOS') || ua.includes('iPhone') || ua.includes('iPad')) {\n os = 'iOS';\n osVersion = ua.match(/OS ([\\d_]+)/)?.[1]?.replace(/_/g, '.') || '';\n }\n\n return { browser, browser_version: browserVersion, os, os_version: osVersion };\n}\n","/**\n * Base HTTP client for all Vesant SDK clients\n *\n * Provides common functionality:\n * - Request/response handling\n * - Error handling\n * - Retry logic with exponential backoff\n * - Timeout management\n * - Debug logging\n */\n\nimport type { BaseClientConfig, Logger, RequestInterceptor, RequestOptions } from './config';\nimport {\n VesantError,\n NetworkError,\n TimeoutError,\n AuthenticationError,\n RateLimitError,\n ServiceUnavailableError,\n ValidationError,\n CircuitBreakerOpenError,\n} from './errors';\nimport { CircuitBreaker, type CircuitBreakerStatus } from './circuit-breaker';\nimport { RateLimitTracker, type RateLimitStatus } from './rate-limiter';\nimport { createConsoleLogger } from './logger';\nimport { SDK_VERSION } from './version';\nimport { generateUUID } from '../shared/browser-utils';\n\nexport abstract class BaseClient {\n protected config: BaseClientConfig & { timeout: number; retries: number };\n protected logger: Logger;\n private interceptors: RequestInterceptor[];\n private circuitBreaker: CircuitBreaker | null = null;\n private rateLimitTracker: RateLimitTracker | null = null;\n\n constructor(config: BaseClientConfig) {\n if (!config.baseURL?.trim()) {\n throw new ValidationError('baseURL is required and must be a non-empty string', ['baseURL']);\n }\n if (!config.tenantId?.trim()) {\n throw new ValidationError('tenantId is required and must be a non-empty string', ['tenantId']);\n }\n\n this.interceptors = config.interceptors || [];\n this.logger = config.logger || createConsoleLogger();\n\n // Auto-detect environment from API key prefix\n let environment = config.environment;\n const apiKey = config.apiKey || '';\n if (apiKey.startsWith('pk_test_')) {\n if (environment === 'production') {\n this.logger.warn('Sandbox API key (pk_test_*) used with environment: \"production\" — overriding to \"sandbox\"');\n }\n environment = 'sandbox';\n } else if (apiKey.startsWith('pk_live_') && environment === 'sandbox') {\n this.logger.warn('Production API key (pk_live_*) used with environment: \"sandbox\" — sandbox isolation will still be applied for backward compatibility');\n }\n\n this.config = {\n ...config,\n apiKey,\n environment,\n headers: config.headers || {},\n timeout: config.timeout || 10000,\n retries: config.retries || 3,\n debug: config.debug || false,\n interceptors: this.interceptors,\n logger: this.logger,\n };\n\n if (config.circuitBreaker) {\n this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);\n }\n if (config.enableRateLimitTracking) {\n this.rateLimitTracker = new RateLimitTracker();\n }\n }\n\n /**\n * Make an HTTP request with timeout and error handling\n */\n protected async request<T>(\n endpoint: string,\n options: RequestInit = {},\n serviceURL?: string,\n requestOptions?: RequestOptions\n ): Promise<T> {\n const requestId = generateUUID();\n\n // Circuit breaker check\n if (this.circuitBreaker && !this.circuitBreaker.canExecute()) {\n const error = new CircuitBreakerOpenError();\n error.requestId = requestId;\n throw error;\n }\n\n // Rate limit pre-check\n if (this.rateLimitTracker && this.rateLimitTracker.isLimitExceeded()) {\n const status = this.rateLimitTracker.getStatus();\n const error = new RateLimitError(status.retryAfter ?? undefined);\n error.requestId = requestId;\n throw error;\n }\n\n const url = `${serviceURL || this.config.baseURL}${endpoint}`;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'X-Tenant-ID': this.config.tenantId,\n 'X-SDK-Version': `vesant-sdk-ts/${SDK_VERSION}`,\n 'X-Request-ID': requestId,\n ...this.config.headers,\n ...((options.headers as Record<string, string>) || {}),\n };\n\n if (this.config.apiKey) {\n headers['Authorization'] = `Bearer ${this.config.apiKey}`;\n }\n\n // Sandbox header\n if (this.config.environment === 'sandbox') {\n headers['X-Sandbox'] = 'true';\n }\n\n // Idempotency key for mutating methods\n const method = (options.method || 'GET').toUpperCase();\n if (['POST', 'PUT', 'PATCH'].includes(method)) {\n headers['Idempotency-Key'] = requestOptions?.idempotencyKey || generateUUID();\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n // Link consumer AbortSignal to internal controller\n if (requestOptions?.signal) {\n if (requestOptions.signal.aborted) {\n controller.abort();\n } else {\n requestOptions.signal.addEventListener('abort', () => controller.abort(), { once: true });\n }\n }\n\n try {\n // Run onRequest interceptors\n let finalOptions: RequestInit = { ...options, headers };\n for (const interceptor of this.interceptors) {\n if (interceptor.onRequest) {\n finalOptions = await interceptor.onRequest(url, finalOptions);\n }\n }\n\n if (this.config.debug) {\n this.logger.debug(`${finalOptions.method || 'GET'} ${endpoint}`);\n }\n\n const response = await fetch(url, {\n ...finalOptions,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n // Track rate limit headers\n if (this.rateLimitTracker) {\n this.rateLimitTracker.updateFromHeaders(response.headers);\n }\n\n // Binary download path\n if (requestOptions?.responseType === 'arraybuffer') {\n if (!response.ok) {\n let errData: Record<string, unknown> = {};\n try { errData = await response.json(); } catch { /* ignore */ }\n this.handleErrorResponse(response.status, errData, requestId);\n }\n this.circuitBreaker?.onSuccess();\n const buffer = await response.arrayBuffer();\n return buffer as unknown as T;\n }\n\n let data: Record<string, unknown> | undefined;\n try {\n data = await response.json();\n } catch {\n // Non-JSON response (HTML error pages, 204 No Content, etc.)\n if (!response.ok) {\n this.handleErrorResponse(response.status, {\n error: `HTTP ${response.status}`,\n message: response.statusText,\n }, requestId);\n }\n // OK response but no JSON body (e.g., 204)\n this.circuitBreaker?.onSuccess();\n return undefined as unknown as T;\n }\n\n if (!response.ok) {\n this.handleErrorResponse(response.status, data || {}, requestId);\n }\n\n // Record success for circuit breaker\n this.circuitBreaker?.onSuccess();\n\n // Run onResponse interceptors\n let result: unknown = data;\n for (const interceptor of this.interceptors) {\n if (interceptor.onResponse) {\n result = await interceptor.onResponse(url, result);\n }\n }\n\n if (this.config.debug) {\n this.logger.debug(`Response: ${response.status}`);\n }\n\n return result as T;\n } catch (error) {\n clearTimeout(timeoutId);\n\n // Record failure for circuit breaker (skip for client errors)\n if (\n error instanceof VesantError &&\n error.statusCode &&\n error.statusCode >= 500\n ) {\n this.circuitBreaker?.onFailure();\n } else if (error instanceof NetworkError || error instanceof TimeoutError) {\n this.circuitBreaker?.onFailure();\n }\n\n // Attach requestId to VesantError instances\n if (error instanceof VesantError && !error.requestId) {\n error.requestId = requestId;\n }\n\n // Run onError interceptors\n if (error instanceof Error) {\n for (const interceptor of this.interceptors) {\n if (interceptor.onError) {\n await interceptor.onError(url, error);\n }\n }\n }\n\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n // Distinguish consumer abort from timeout\n if (requestOptions?.signal?.aborted) {\n const abortError = new VesantError('Request aborted', 'REQUEST_ABORTED');\n abortError.requestId = requestId;\n throw abortError;\n }\n this.circuitBreaker?.onFailure();\n const timeoutError = new TimeoutError(this.config.timeout);\n timeoutError.requestId = requestId;\n throw timeoutError;\n }\n if (error instanceof VesantError) {\n throw error;\n }\n }\n\n const networkError = new NetworkError('Network request failed', error);\n networkError.requestId = requestId;\n this.circuitBreaker?.onFailure();\n throw networkError;\n }\n }\n\n /**\n * Make an HTTP request with retry logic\n */\n protected async requestWithRetry<T>(\n endpoint: string,\n options: RequestInit = {},\n serviceURL?: string,\n retries: number = this.config.retries,\n requestOptions?: RequestOptions\n ): Promise<T> {\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n return await this.request<T>(endpoint, options, serviceURL, requestOptions);\n } catch (error) {\n lastError = error instanceof Error ? error : new Error('Unknown error');\n\n // Don't retry on consumer abort\n if (requestOptions?.signal?.aborted) {\n throw lastError;\n }\n\n // Don't retry on client errors (4xx), except 429 (rate limit)\n if (\n lastError instanceof VesantError &&\n lastError.statusCode &&\n lastError.statusCode >= 400 &&\n lastError.statusCode < 500 &&\n lastError.statusCode !== 429\n ) {\n throw lastError;\n }\n\n // Don't retry on last attempt\n if (attempt === retries) {\n break;\n }\n\n // Use Retry-After for 429, otherwise exponential backoff with jitter\n let delay: number;\n if (lastError instanceof RateLimitError && lastError.retryAfter) {\n delay = lastError.retryAfter * 1000;\n } else {\n delay = Math.min(1000 * Math.pow(2, attempt) + Math.random() * 1000, 10000);\n }\n await new Promise((resolve) => setTimeout(resolve, delay));\n\n if (this.config.debug) {\n this.logger.debug(`Retry attempt ${attempt + 1}/${retries} after ${delay.toFixed(0)}ms`);\n }\n }\n }\n\n throw new NetworkError(`Request failed after ${retries} retries`, lastError);\n }\n\n /**\n * Handle error responses from API\n */\n protected handleErrorResponse(status: number, data: Record<string, unknown>, requestId?: string): never {\n const message = (data.error as string) || (data.message as string) || `HTTP ${status}`;\n\n const createError = (): VesantError => {\n switch (status) {\n case 400:\n return new VesantError(message, 'BAD_REQUEST', 400);\n case 401:\n return new AuthenticationError(message);\n case 403:\n return new VesantError(message, 'FORBIDDEN', 403);\n case 404:\n return new VesantError(message, 'NOT_FOUND', 404);\n case 409:\n return new VesantError(message, 'DUPLICATE_PROFILE', 409);\n case 429: {\n const retryAfter = (data.retry_after as number | undefined) || (data.retryAfter as number | undefined);\n return new RateLimitError(retryAfter);\n }\n case 500:\n case 502:\n case 503:\n case 504:\n return new ServiceUnavailableError(message);\n default:\n return new VesantError(message, 'UNKNOWN_ERROR', status);\n }\n };\n\n const error = createError();\n if (requestId) {\n error.requestId = requestId;\n }\n throw error;\n }\n\n /**\n * Build query string from parameters\n */\n protected buildQueryString(params: Record<string, unknown>): string {\n const query = new URLSearchParams();\n\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n value.forEach((item) => query.append(key, String(item)));\n } else {\n query.append(key, String(value));\n }\n }\n });\n\n const queryString = query.toString();\n return queryString ? `?${queryString}` : '';\n }\n\n /**\n * Update client configuration\n */\n updateConfig(config: Partial<BaseClientConfig>): void {\n this.config = {\n ...this.config,\n ...config,\n headers: {\n ...this.config.headers,\n ...(config.headers || {}),\n },\n };\n if (config.logger) {\n this.logger = config.logger;\n }\n if (config.interceptors) {\n this.interceptors = config.interceptors;\n }\n }\n\n /**\n * Get current configuration (readonly)\n */\n getConfig(): Readonly<BaseClientConfig> {\n return { ...this.config };\n }\n\n /**\n * Get rate limit status from tracked response headers.\n */\n getRateLimitStatus(): RateLimitStatus | null {\n return this.rateLimitTracker?.getStatus() ?? null;\n }\n\n /**\n * Get circuit breaker status.\n */\n getCircuitBreakerStatus(): CircuitBreakerStatus | null {\n return this.circuitBreaker?.getStatus() ?? null;\n }\n\n /**\n * Health check endpoint\n */\n async healthCheck(): Promise<{ status: string; timestamp: string }> {\n return this.request('/api/v1/health');\n }\n}\n","/**\n * KycClient - TypeScript SDK for Vesant KYC (Know Your Customer) Service\n *\n * Provides type-safe methods to interact with the KYC service API.\n * Extends BaseClient for consistent retry logic, timeout handling, and error management.\n */\n\nimport { BaseClient } from '../core/client';\nimport { ValidationError } from '../core/errors';\nimport type { BaseClientConfig } from '../core/config';\nimport type {\n KycClientConfig,\n KycRequest,\n KycRequestFilters,\n KycRequestListResponse,\n DocumentVerificationRequest,\n DocumentVerificationResponse,\n UpdateKycStatusRequest,\n RequestAdditionalDocumentsRequest,\n RequestKycSubmitLinkRequest,\n RequestKycSubmitLinkResponse,\n CheckKycStatusRequest,\n CheckKycStatusResponse,\n ProofDownloadURL,\n KycOverview,\n KycAlert,\n KycAlertFilters,\n KycAlertListResponse,\n UpdateKycAlertRequest,\n KycPreferences,\n UpdateKycPreferencesRequest,\n PaginationParams,\n CustomerProfile,\n CustomerProfileFilters,\n CustomerProfileListResponse,\n CreateCustomerProfileRequest,\n CreateReuseKycSessionRequest,\n CreateReuseKycSessionResponse,\n SubmitReuseKycSessionRequest,\n} from './types';\n\n/** Helper to add filter value to params, joining arrays with commas */\nfunction addFilterParam(\n params: Record<string, unknown>,\n key: string,\n value: string | string[] | undefined\n): void {\n if (value !== undefined) {\n params[key] = Array.isArray(value) ? value.join(',') : value;\n }\n}\n\n/** Helper to add simple filter values to params */\nfunction addSimpleParams(\n params: Record<string, unknown>,\n source: Record<string, unknown>,\n keys: string[]\n): void {\n for (const key of keys) {\n if (source[key] !== undefined) {\n params[key] = source[key];\n }\n }\n}\n\n/**\n * KycClient extends BaseClient for:\n * - Consistent retry logic with exponential backoff\n * - Unified error handling (VesantError, NetworkError, TimeoutError, etc.)\n * - Automatic timeout management\n * - Debug logging\n *\n * All KYC verification calls use requestWithRetry() to handle\n * transient failures gracefully.\n */\nexport class KycClient extends BaseClient {\n private userId?: string;\n private riskProfileBaseURL?: string;\n\n constructor(config: KycClientConfig) {\n // Convert KycClientConfig to BaseClientConfig\n const baseConfig: BaseClientConfig = {\n baseURL: config.baseURL,\n tenantId: config.tenantId,\n apiKey: config.apiKey,\n headers: config.headers,\n timeout: config.timeout,\n retries: 3, // Default retry count for KYC calls\n debug: config.debug,\n environment: config.environment,\n };\n super(baseConfig);\n this.userId = config.userId;\n this.riskProfileBaseURL = config.riskProfileBaseURL;\n }\n\n /**\n * Set the user ID for operations requiring user context\n */\n setUserId(userId: string): void {\n this.userId = userId;\n }\n\n /**\n * Get current user ID\n */\n getUserId(): string | undefined {\n return this.userId;\n }\n\n /**\n * Build headers including user ID if available\n */\n private getUserHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n if (this.userId) {\n headers['X-User-ID'] = this.userId;\n }\n return headers;\n }\n\n // ============================================================================\n // Document Verification\n // ============================================================================\n\n /**\n * Request a KYC submission redirect URL for a user\n *\n * Generates a link that the user can visit to submit their KYC documents.\n *\n * @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)\n * @returns Response containing the redirect link and KYC ID\n *\n * @example\n * ```typescript\n * const result = await client.requestKycSubmitLink({\n * user_id: \"user_123\",\n * redirect_url: \"https://merchant.com/kyc-complete\", // optional\n * callback_url: \"https://merchant.com/api/kyc-webhook\" // optional - receives POST requests on status change\n * });\n *\n * console.log(`Redirect user to: ${result.link}`);\n * console.log(`KYC ID: ${result.kyc_id}`);\n * ```\n */\n async requestKycSubmitLink(\n request: RequestKycSubmitLinkRequest\n ): Promise<RequestKycSubmitLinkResponse> {\n return this.requestWithRetry<RequestKycSubmitLinkResponse>('/api/v1/kyc/request', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Create a reuse KYC session for validate a user with existing KYC verification\n *\n * @param request - Request containing the reference, customer_id, optional redirect URL, and callback URL (receives POST requests)\n */\n async createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse> {\n return this.requestWithRetry<CreateReuseKycSessionResponse>('/api/v1/kyc/face/session', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Submit a reuse KYC session for validate a user with existing KYC verification\n *\n * @param request - Request containing the reference, token and proof (receives POST requests)\n */\n async submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<CheckKycStatusResponse> {\n return this.requestWithRetry<CheckKycStatusResponse>('/api/v1/kyc/face/submit', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Check reuse KYC session status for a reference\n * @param reference - The unique reference used for the reuse KYC session (e.g., customer ID or transaction ID)\n * @returns Response with kyc_status and message (reason)\n * **/\n async getReuseKycSessionStatus(reference: string): Promise<CheckKycStatusResponse> {\n return this.requestWithRetry<CheckKycStatusResponse>(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {\n method: 'GET',\n headers: this.getUserHeaders(),\n });\n }\n /**\n * Check KYC status for a user\n *\n * Returns the current KYC status:\n * - \"complete\" → KYC verified, show \"Continue to Login\"\n * - \"processing\" → Under review, show \"Continue to Login\"\n * - \"failed\" / \"declined\" → Show error + retry option\n * - \"pending\" / \"in_progress\" → Keep polling\n *\n * @param request - Request containing user_id and token\n * @returns Response with kyc_status and message (reason)\n *\n * @example\n * ```typescript\n * const result = await client.checkKycStatus({\n * user_id: \"user_123\",\n * token: \"auth_token_xyz\"\n * });\n *\n * if (result.kyc_status === 'complete') {\n * // Show \"Continue to Login\"\n * } else if (result.kyc_status === 'failed' || result.kyc_status === 'declined') {\n * // Show error + retry option\n * } else {\n * // Keep polling\n * }\n * ```\n */\n async checkKycStatus(\n request: CheckKycStatusRequest\n ): Promise<CheckKycStatusResponse> {\n const params = {\n user_id: request.user_id,\n kyc_id: request.kyc_id,\n };\n\n return this.requestWithRetry<CheckKycStatusResponse>(\n `/api/v1/kyc/request/status${this.buildQueryString(params)}`,\n {\n method: 'GET',\n headers: this.getUserHeaders(),\n }\n );\n }\n\n /**\n * Submit a document verification request with OCR\n *\n * Uses requestWithRetry() for automatic retry on transient failures.\n *\n * @param request - Document verification request with documents and customer info\n * @returns Verification response with status and reference\n *\n * @example\n * ```typescript\n * const result = await client.submitVerification({\n * reference: \"customer_123\",\n * email: \"customer@example.com\",\n * country: \"US\",\n * document: {\n * proof: base64EncodedImage,\n * selected_type: [\"id_card\", \"passport\"],\n * name: { first_name: \"John\", last_name: \"Doe\" },\n * dob: \"1990-01-15\"\n * },\n * face: {\n * proof: base64EncodedSelfie\n * }\n * });\n *\n * console.log(`Verification submitted: ${result.reference}`);\n * ```\n */\n async submitVerification(\n request: DocumentVerificationRequest\n ): Promise<DocumentVerificationResponse> {\n return this.requestWithRetry<DocumentVerificationResponse>('/api/v1/kyc/submit', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Get a KYC request by ID\n *\n * @param id - KYC request ID\n * @returns KYC request details including proofs and alerts\n *\n * @example\n * ```typescript\n * const kyc = await client.getKycRequest(\"kyc_abc123\");\n * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);\n * ```\n */\n async getKycRequest(id: string): Promise<KycRequest> {\n return this.request<KycRequest>(`/api/v1/kyc/requests/${id}`);\n }\n\n /**\n * List KYC requests with filters and pagination\n *\n * @param filters - Optional filters (status, search, date range)\n * @param pagination - Optional pagination (page, page_size)\n * @returns Paginated list of KYC requests\n *\n * @example\n * ```typescript\n * const requests = await client.listKycRequests(\n * { status: \"pending\", search: \"john\" },\n * { page: 1, page_size: 20 }\n * );\n * console.log(`Found ${requests.total} pending requests`);\n * ```\n */\n async listKycRequests(\n filters?: KycRequestFilters,\n pagination?: PaginationParams\n ): Promise<KycRequestListResponse> {\n const params: Record<string, unknown> = {};\n\n if (filters) {\n addFilterParam(params, 'status', filters.status);\n addSimpleParams(params, filters as unknown as Record<string, unknown>, ['search', 'fromDate', 'toDate', 'sortBy', 'order']);\n }\n\n if (pagination) {\n if (pagination.page) params.page = pagination.page;\n if (pagination.page_size) params.limit = pagination.page_size;\n }\n\n return this.request<KycRequestListResponse>(\n `/api/v1/kyc/requests${this.buildQueryString(params)}`,\n { headers: this.getUserHeaders() }\n );\n }\n\n /**\n * Update KYC request status (accept/decline)\n *\n * @param request - Status update request with reference, status, and reason\n *\n * @example\n * ```typescript\n * // Accept a KYC request\n * await client.updateKycStatus({\n * reference: \"shufti_ref_123\",\n * status: \"accepted\",\n * reason: \"All documents verified successfully\"\n * });\n *\n * // Decline a KYC request\n * await client.updateKycStatus({\n * reference: \"shufti_ref_456\",\n * status: \"declined\",\n * reason: \"Document expired\"\n * });\n * ```\n */\n async updateKycStatus(request: UpdateKycStatusRequest): Promise<void> {\n await this.request('/api/v1/kyc/status', {\n method: 'PUT',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Request additional documents from customer\n *\n * @param request - Request with KYC ID and document types needed\n *\n * @example\n * ```typescript\n * await client.requestAdditionalDocuments({\n * id: \"kyc_abc123\",\n * document_types: [\"address\", \"document_two\"],\n * message: \"Please provide proof of address and secondary ID\"\n * });\n * ```\n */\n async requestAdditionalDocuments(\n request: RequestAdditionalDocumentsRequest\n ): Promise<void> {\n await this.request('/api/v1/kyc/requests', {\n method: 'PUT',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Get downloadable URLs for KYC proofs/documents\n *\n * @param kycId - KYC request ID\n * @returns Array of proof download URLs with expiration\n *\n * @example\n * ```typescript\n * const proofs = await client.getProofDownloadURLs(\"kyc_abc123\");\n * proofs.forEach(proof => {\n * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);\n * });\n * ```\n */\n async getProofDownloadURLs(kycId: string): Promise<ProofDownloadURL[]> {\n return this.request<ProofDownloadURL[]>(\n `/api/v1/kyc/proofs/${kycId}`,\n { headers: this.getUserHeaders() }\n );\n }\n\n // ============================================================================\n // KYC Overview & Statistics\n // ============================================================================\n\n /**\n * Get KYC overview statistics\n *\n * @param fromDate - Optional start date (ISO 8601)\n * @param toDate - Optional end date (ISO 8601)\n * @returns KYC statistics including counts by status\n *\n * @example\n * ```typescript\n * const overview = await client.getOverview(\n * \"2024-01-01T00:00:00Z\",\n * \"2024-12-31T23:59:59Z\"\n * );\n * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);\n * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);\n * ```\n */\n async getOverview(fromDate?: string, toDate?: string): Promise<KycOverview> {\n const params: Record<string, unknown> = {};\n if (fromDate) params.fromDate = fromDate;\n if (toDate) params.toDate = toDate;\n\n return this.request<KycOverview>(\n `/api/v1/kyc/overview${this.buildQueryString(params)}`\n );\n }\n\n // ============================================================================\n // Alert Management\n // ============================================================================\n\n /**\n * Get a KYC alert by ID\n *\n * @param alertId - Alert ID\n * @returns Alert details\n */\n async getAlert(alertId: string): Promise<KycAlert> {\n return this.request<KycAlert>(`/api/v1/kyc/alerts/${alertId}`);\n }\n\n /**\n * List KYC alerts with filters and pagination\n *\n * @param filters - Optional filters (status, risk, alert_type, assigned_for, etc.)\n * @param pagination - Optional pagination (page, page_size)\n * @returns Paginated list of alerts\n *\n * @example\n * ```typescript\n * const alerts = await client.listAlerts(\n * {\n * status: [\"pending\", \"in_progress\"],\n * risk: \"critical\",\n * alert_type: \"kyc\"\n * },\n * { page: 1, page_size: 20 }\n * );\n * console.log(`Found ${alerts.total} alerts`);\n * ```\n */\n async listAlerts(\n filters?: KycAlertFilters,\n pagination?: PaginationParams\n ): Promise<KycAlertListResponse> {\n const params: Record<string, unknown> = {};\n\n if (filters) {\n // Array filters that need comma joining\n addFilterParam(params, 'kyc_id', filters.kyc_id);\n addFilterParam(params, 'alert_type', filters.alert_type);\n addFilterParam(params, 'assigned_for', filters.assigned_for);\n addFilterParam(params, 'status', filters.status);\n addFilterParam(params, 'risk', filters.risk);\n // Simple filters\n addSimpleParams(params, filters as unknown as Record<string, unknown>, ['search', 'fromDate', 'toDate', 'sort_by', 'order']);\n }\n\n if (pagination) {\n if (pagination.page) params.page = pagination.page;\n if (pagination.page_size) params.limit = pagination.page_size;\n }\n\n return this.request<KycAlertListResponse>(\n `/api/v1/kyc/alerts${this.buildQueryString(params)}`\n );\n }\n\n /**\n * Update a KYC alert\n *\n * @param alertId - Alert ID\n * @param update - Fields to update (status, assigned_for, reason, alert_type)\n *\n * @example\n * ```typescript\n * // Assign an alert\n * await client.updateAlert(\"alert_123\", {\n * assigned_for: \"analyst_user_id\",\n * status: \"in_progress\"\n * });\n *\n * // Resolve an alert\n * await client.updateAlert(\"alert_123\", {\n * status: \"resolved\",\n * reason: \"Customer verified via phone call\"\n * });\n *\n * // Escalate an alert\n * await client.updateAlert(\"alert_123\", {\n * status: \"escalated\",\n * assigned_for: \"manager_user_id\",\n * reason: \"Requires senior review - suspicious documents\"\n * });\n * ```\n */\n async updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void> {\n await this.request(`/api/v1/kyc/alerts/${alertId}`, {\n method: 'PUT',\n body: JSON.stringify(update),\n headers: this.getUserHeaders(),\n });\n }\n\n // ============================================================================\n // KYC Preferences\n // ============================================================================\n\n /**\n * Get KYC preferences for the tenant\n *\n * @returns KYC preferences configuration\n *\n * @example\n * ```typescript\n * const prefs = await client.getPreferences();\n * console.log(`Face verification required: ${prefs.is_face_verification_required}`);\n * console.log(`Required documents: ${prefs.required_document_count}`);\n * ```\n */\n async getPreferences(): Promise<KycPreferences> {\n return this.request<KycPreferences>('/api/v1/kyc/preferences');\n }\n\n /**\n * Update KYC preferences for the tenant\n *\n * @param update - Fields to update\n * @returns Updated preferences\n *\n * @example\n * ```typescript\n * await client.updatePreferences({\n * is_face_verification_required: true,\n * is_address_verification_required: true,\n * required_document_count: 2,\n * reasons: [\n * \"Documents verified\",\n * \"Identity confirmed\",\n * \"Address matched\"\n * ]\n * });\n * ```\n */\n async updatePreferences(\n update: UpdateKycPreferencesRequest\n ): Promise<KycPreferences> {\n return this.request<KycPreferences>('/api/v1/kyc/preferences', {\n method: 'PUT',\n body: JSON.stringify(update),\n });\n }\n\n // ============================================================================\n // Customer Profile Management (Risk Profile Service)\n // ============================================================================\n\n /**\n * Make a request to the Risk Profile Service\n * Uses riskProfileBaseURL if configured, otherwise falls back to baseURL\n */\n private async riskProfileRequest<T>(\n path: string,\n options: RequestInit = {}\n ): Promise<T> {\n if (!this.riskProfileBaseURL) {\n throw new ValidationError(\n 'Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.',\n ['riskProfileBaseURL']\n );\n }\n\n return this.request<T>(path, {\n ...options,\n headers: {\n ...this.getUserHeaders(),\n ...(options.headers as Record<string, string>),\n },\n }, this.riskProfileBaseURL);\n }\n\n /**\n * List customer profiles for the tenant\n *\n * @param filters - Optional filters (risk_category, entity_type, status, search, etc.)\n * @param pagination - Optional pagination (limit, offset)\n * @returns Paginated list of customer profiles\n *\n * @example\n * ```typescript\n * const profiles = await client.listCustomerProfiles(\n * { risk_category: 'high', entity_type: 'individual' },\n * { limit: 20, offset: 0 }\n * );\n * console.log(`Found ${profiles.total} profiles`);\n * profiles.profiles.forEach(p => console.log(p.customer_id, p.full_name));\n * ```\n */\n async listCustomerProfiles(\n filters?: CustomerProfileFilters,\n pagination?: { limit?: number; offset?: number }\n ): Promise<CustomerProfileListResponse> {\n const params: Record<string, unknown> = {};\n\n if (filters) {\n // Array filters (keep as arrays for this API)\n if (filters.risk_category) {\n params.risk_category = Array.isArray(filters.risk_category)\n ? filters.risk_category\n : [filters.risk_category];\n }\n if (filters.entity_type) {\n params.entity_type = Array.isArray(filters.entity_type)\n ? filters.entity_type\n : [filters.entity_type];\n }\n if (filters.status) {\n params.status = Array.isArray(filters.status)\n ? filters.status\n : [filters.status];\n }\n // Simple filters\n addSimpleParams(params, filters as unknown as Record<string, unknown>, [\n 'search', 'is_pep', 'has_sanctions', 'requires_edd', 'sort_by', 'sort_order'\n ]);\n }\n\n if (pagination) {\n addSimpleParams(params, pagination, ['limit', 'offset']);\n }\n\n return this.riskProfileRequest<CustomerProfileListResponse>(\n `/api/v1/risk-dashboard/profiles${this.buildQueryString(params)}`\n );\n }\n\n /**\n * Get a customer profile by ID\n *\n * @param profileId - The profile UUID\n * @returns Customer profile details\n *\n * @example\n * ```typescript\n * const profile = await client.getCustomerProfile('uuid-here');\n * console.log(`Customer: ${profile.full_name}, Risk: ${profile.risk_category}`);\n * ```\n */\n async getCustomerProfile(profileId: string): Promise<CustomerProfile> {\n return this.riskProfileRequest<CustomerProfile>(\n `/api/v1/risk-dashboard/profiles/${profileId}`\n );\n }\n\n /**\n * Create a new customer profile\n *\n * A customer profile must exist before submitting KYC verification.\n * The customer_id field will be used as the 'reference' in KYC submissions.\n *\n * @param profile - Customer profile data\n * @returns Created customer profile\n *\n * @example\n * ```typescript\n * const profile = await client.createCustomerProfile({\n * customer_id: 'cust_123',\n * entity_type: 'individual',\n * full_name: 'John Doe',\n * email_address: 'john@example.com',\n * country_of_residence: 'US'\n * });\n * console.log(`Created profile: ${profile.id}`);\n *\n * // Now you can submit KYC using the customer_id as reference\n * await client.submitVerification({\n * reference: profile.customer_id, // 'cust_123'\n * email: 'john@example.com',\n * // ... other fields\n * });\n * ```\n */\n async createCustomerProfile(\n profile: CreateCustomerProfileRequest\n ): Promise<CustomerProfile> {\n return this.riskProfileRequest<CustomerProfile>('/api/v1/profiles', {\n method: 'POST',\n body: JSON.stringify(profile),\n });\n }\n\n // ============================================================================\n // Utility Methods (inherited from BaseClient: healthCheck, updateConfig, getConfig, buildQueryString)\n // ============================================================================\n}\n","/**\n * TypeScript type definitions for Vesant KYC Service API\n *\n * These types match the Go API structures in:\n * - services/kyc-service/internal/domain/\n * - services/kyc-service/internal/service/\n * - services/kyc-service/internal/handler/\n */\n\nimport type { PaginationParams, RiskLevel } from '../core/types';\n\n// Re-export commonly used types from core\nexport type { PaginationParams, RiskLevel };\n\n// ============================================================================\n// KYC Status & Enumerations\n// ============================================================================\n\nexport type KycStatus = 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';\n\nexport type KycDeclinedCode =\n | 'KYC_DOCUMENT_EXPIRED'\n | 'KYC_DOCUMENT_INVALID'\n | 'KYC_FACE_MISMATCH'\n | 'KYC_AGE_REQUIREMENT'\n | 'KYC_DUPLICATE_IDENTITY'\n | 'KYC_ADDRESS_MISMATCH'\n | 'KYC_NAME_MISMATCH'\n | 'KYC_PROVIDER_REJECTED'\n | 'KYC_DECLINED';\n\nexport const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string> = {\n KYC_DOCUMENT_EXPIRED: 'The submitted document has expired',\n KYC_DOCUMENT_INVALID: 'The submitted document could not be verified',\n KYC_FACE_MISMATCH: 'Face verification did not match the identity document',\n KYC_AGE_REQUIREMENT: 'Age requirement not met',\n KYC_DUPLICATE_IDENTITY: 'This identity has already been verified under another account',\n KYC_ADDRESS_MISMATCH: 'Address verification failed',\n KYC_NAME_MISMATCH: 'Name on document does not match the registered name',\n KYC_PROVIDER_REJECTED: 'Identity verification was rejected by the verification provider',\n KYC_DECLINED: 'Identity verification was declined',\n};\n\nexport type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';\n\nexport type KycAlertType = 'kyc' | 'fraud';\n\nexport type DocumentType = 'id_card' | 'driving_license' | 'passport';\n\nexport type ProofType =\n | 'document'\n | 'document_two'\n | 'face'\n | 'address'\n | 'additional_document';\n\nexport type SupportedDocumentType = 'id_card' | 'passport' | 'driving_license';\n\n// ============================================================================\n// KYC Request Types\n// ============================================================================\n\nexport interface KycRequest {\n id: string;\n reference: string;\n forward_reference?: string;\n tenant_id: string;\n first_name: string;\n middle_name?: string;\n last_name: string;\n dob?: string;\n full_address?: string;\n email?: string;\n\n // Verification Status Flags\n id_verified: boolean;\n address_verified: boolean;\n face_verified: boolean;\n age_verified: boolean;\n\n // Overall Status\n status: KycStatus;\n location?: string;\n identity_hash?: string;\n\n // Preferences at time of submission\n required_document_count: number;\n supported_document_types?: SupportedDocumentType[];\n is_id_verification_required: boolean;\n is_face_verification_required: boolean;\n is_address_verification_required: boolean;\n is_age_verification_required: boolean;\n\n // URLs\n callback_url: string;\n redirect_url?: string;\n\n // Reasons & Warnings\n declined_reason?: string;\n declined_code?: KycDeclinedCode;\n accepted_reason?: string;\n other_reason?: string;\n warnings?: Record<string, Record<string, string>>;\n\n // Relationships\n proofs?: Proof[];\n alerts?: KycAlert[];\n risk_profile?: KycCustomerProfile;\n\n created_at: string;\n updated_at: string;\n}\n\nexport interface Proof {\n id: string;\n kyc_id: string;\n type: ProofType;\n document: string;\n document_number?: string;\n created_at: string;\n}\n\nexport interface ProofDownloadURL {\n type: ProofType;\n url: string;\n expires_at: string;\n}\n\n// ============================================================================\n// KYC Customer Profile (Risk Profile Reference)\n// ============================================================================\n\nexport interface KycCustomerProfile {\n id: string;\n tenant_id: string;\n customer_id: string;\n first_name?: string;\n last_name?: string;\n email?: string;\n risk_score: number;\n risk_level: RiskLevel;\n kyc_status?: string;\n pep_status?: boolean;\n sanctions_status?: boolean;\n created_at: string;\n updated_at: string;\n}\n\n// ============================================================================\n// KYC Alert Types\n// ============================================================================\n\nexport interface KycAlert {\n id: string;\n kyc_id: string;\n tenant_id: string;\n alert_type: KycAlertType;\n alert_text: string;\n risk: RiskLevel;\n assigned_for?: string;\n reason?: string;\n status: KycAlertStatus;\n created_at: string;\n updated_at: string;\n}\n\nexport interface KycAlertFilters {\n kyc_id?: string | string[];\n alert_type?: KycAlertType | KycAlertType[];\n assigned_for?: string | string[];\n status?: KycAlertStatus | KycAlertStatus[];\n risk?: RiskLevel | RiskLevel[];\n search?: string;\n fromDate?: string;\n toDate?: string;\n sort_by?: string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface KycAlertListResponse {\n alerts: KycAlert[];\n pagination: KycPagination;\n}\n\nexport interface UpdateKycAlertRequest {\n assigned_for?: string;\n reason?: string;\n alert_type?: KycAlertType;\n status?: KycAlertStatus;\n}\n\n// ============================================================================\n// KYC Preferences Types\n// ============================================================================\n\nexport interface KycPreferences {\n id: string;\n tenant_id: string;\n approve_kyc_reasons: string[];\n is_document_verification_required: boolean;\n is_face_verification_required: boolean;\n is_address_verification_required: boolean;\n is_age_verification_required: boolean;\n min_age: number;\n max_age: number;\n required_document_count: number;\n critical_risk_score: number;\n high_risk_score: number;\n medium_risk_score: number;\n supported_document_types: SupportedDocumentType[];\n created_at: string;\n updated_at: string;\n}\n\nexport interface UpdateKycPreferencesRequest {\n reasons?: string[];\n is_document_verification_required?: boolean;\n is_face_verification_required?: boolean;\n is_address_verification_required?: boolean;\n is_age_verification_required?: boolean;\n min_age?: number;\n max_age?: number;\n required_document_count?: number;\n critical_risk_score?: number;\n high_risk_score?: number;\n medium_risk_score?: number;\n supported_document_types?: SupportedDocumentType[];\n}\n\n// ============================================================================\n// Document Verification Request Types\n// ============================================================================\n\nexport interface Name {\n first_name?: string;\n middle_name?: string;\n last_name?: string;\n full_name?: string;\n}\n\nexport interface SubmittedDocument {\n /** Base64 encoded document image */\n proof: string;\n /** Base64 additional document image (back side, etc.) */\n additional_proof?: string;\n /** Document number for search/verification */\n document_number?: string;\n /** Document types to verify against */\n selected_type?: DocumentType[];\n /** Extracted/provided name */\n name?: Name;\n /** Date of birth (YYYY-MM-DD) */\n dob?: string;\n /** Issue date (YYYY-MM-DD) */\n issue_date?: string;\n /** Expiry date (YYYY-MM-DD) */\n expiry_date?: string;\n /** Gender */\n gender?: string;\n}\n\nexport interface FaceProof {\n /** Base64 encoded face image or selfie */\n proof: string;\n}\n\nexport interface DocumentVerificationRequest {\n /** Customer reference ID */\n reference: string;\n /** Callback URL for async verification results */\n callback_url: string;\n /** Customer email */\n email: string;\n /** Country code (ISO 3166-1 alpha-2) */\n country: string;\n /** Language code */\n language: string;\n /** Full address for verification */\n full_address?: string;\n /** Base64 encoded address proof document */\n address_proof?: string;\n /** Primary document */\n document: SubmittedDocument;\n /** Secondary document (optional) */\n document_two?: SubmittedDocument;\n /** Face verification proof (optional) */\n face?: FaceProof;\n /** Additional metadata */\n token?: string;\n}\n\nexport interface DocumentVerificationResponse {\n id: string;\n reference: string;\n status: KycStatus;\n verification_url?: string;\n message?: string;\n}\n\n// ============================================================================\n// KYC Status Update Types\n// ============================================================================\n\nexport interface UpdateKycStatusRequest {\n /** Shufti reference or KYC ID */\n reference: string;\n /** Target status */\n status: KycStatus;\n /** Acceptance/decline reason */\n reason?: string;\n /** Shufti warnings data */\n warnings?: Record<string, Record<string, string>>;\n}\n\n// ============================================================================\n// KYC Submit Link Request Types\n// ============================================================================\n\nexport interface RequestKycSubmitLinkRequest {\n /** User ID to generate KYC submission link for */\n user_id: string;\n /** URL to redirect user after KYC submission (optional) */\n redirect_url?: string;\n /** URL to receive callback notifications via POST request when KYC status changes (optional) */\n callback_url?: string;\n /** Event that triggered the KYC request (e.g. \"onboarding\", \"login\", \"transaction\") */\n trigger_event?: string;\n}\n\nexport interface CreateReuseKycSessionRequest {\n /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */\n reference: string;\n /** customer ID to associate with the KYC session */\n customer_id: string;\n /** where the re-use-kyc using 'login' | 'transactions' */\n path?: string;\n /** URL to redirect user after validate the facial submission (optional) */\n redirect_url?: string;\n /** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */\n callback_url?: string;\n}\n\nexport interface SubmitReuseKycSessionRequest {\n /** Reuse KYC session token generated from createReUseKycSession endpoint */\n token: string;\n /** Base64 encoded face image or selfie for verification */\n proof: string;\n /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */\n reference?: string;\n}\n\nexport interface RequestKycSubmitLinkResponse {\n /** Generated KYC submission redirect URL */\n link: string;\n /** KYC request ID */\n kyc_id: string;\n}\n\nexport interface CreateReuseKycSessionResponse {\n /** Generated reuse KYC session token, valid X minutes */\n token: string;\n /** reuse KYC session reference */\n reference: string;\n\n /** re-use-kyc required for the action or not */\n is_required: boolean\n}\n\n// ============================================================================\n// KYC Status Check Types\n// ============================================================================\n\nexport interface CheckKycStatusRequest {\n /** User ID to check KYC status for */\n user_id: string;\n /** Authentication token */\n kyc_id: string;\n}\n\n/**\n * Response from checkKycStatus. Always returns the same shape.\n *\n * `additional_data` is `null` when `status === 'pending'`.\n * When `status !== 'pending'`, `additional_data` contains the full KYC record\n * including document details, proofs, and the customer's risk profile.\n */\nexport interface CheckKycStatusResponse {\n id: string;\n forward_reference: string;\n status: KycStatus;\n id_verified: boolean;\n address_verified: boolean;\n face_verified: boolean;\n age_verified: boolean;\n declined_reason?: string;\n declined_code?: KycDeclinedCode;\n other_reason?: string;\n accepted_reason?: string;\n warnings?: Record<string, Record<string, string>>;\n required_document_count: number;\n supported_document_types?: SupportedDocumentType[];\n is_id_verification_required: boolean;\n is_face_verification_required: boolean;\n is_address_verification_required: boolean;\n is_age_verification_required: boolean;\n created_at: string;\n /** Full KYC record with document details, proofs, and risk profile. Null when status is 'pending'. */\n additional_data: KycRequest | null;\n}\n\nexport interface RequestAdditionalDocumentsRequest {\n /** KYC request ID */\n id: string;\n /** Document types to request */\n document_types: ProofType[];\n /** Message to customer */\n message?: string;\n}\n\n// ============================================================================\n// KYC Overview & Statistics Types\n// ============================================================================\n\nexport interface KycOverview {\n total: number;\n pending: number;\n approved: number;\n high_risk: number;\n rejected: number;\n id_verified: number;\n address_verified: number;\n face_verified: number;\n rejections: number;\n total_alerts: number;\n pending_alerts: number;\n resolved_alerts: number;\n}\n\n// ============================================================================\n// KYC Request Listing Types\n// ============================================================================\n\nexport interface KycRequestFilters {\n status?: KycStatus | KycStatus[];\n search?: string;\n fromDate?: string;\n toDate?: string;\n sortBy?: string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface KycPagination {\n limit: number;\n page: number;\n total: number;\n totalPages: number;\n}\n\nexport interface KycRequestListResponse {\n data: KycRequest[];\n pagination: KycPagination;\n}\n\n// ============================================================================\n// Customer Profile Types (Re-exported from risk-profile module)\n// ============================================================================\n\n// Import types from risk-profile module for use in KYC client\nimport type {\n CustomerProfile as RiskProfileCustomerProfile,\n CreateProfileRequest,\n ProfileFilters,\n ProfileListResponse,\n} from '../risk-profile/types';\n\n// Export types for internal use in KYC client (aliased to avoid conflicts with main exports)\n// Users should import CustomerProfile, CreateProfileRequest, etc. from 'vesant-sdk/risk-profile'\nexport type {\n RiskProfileCustomerProfile as CustomerProfile,\n CreateProfileRequest as CreateCustomerProfileRequest,\n ProfileFilters as CustomerProfileFilters,\n ProfileListResponse as CustomerProfileListResponse,\n};\n\n// ============================================================================\n// SDK Configuration Types\n// ============================================================================\n\nexport interface KycClientConfig {\n /** Base URL of the KYC Service API (e.g., \"http://localhost:8088\") */\n baseURL: string;\n\n /** Base URL of the Customer Risk Profile Service API (e.g., \"http://localhost:8094\") */\n riskProfileBaseURL?: string;\n\n /** Tenant ID for multi-tenancy */\n tenantId: string;\n\n /** API key or JWT token for authentication */\n apiKey?: string;\n\n /** User ID for operations requiring user context */\n userId?: string;\n\n /** Custom headers to include in every request */\n headers?: Record<string, string>;\n\n /** Request timeout in milliseconds (default: 10000) */\n timeout?: number;\n\n /** Enable debug logging */\n debug?: boolean;\n\n /** Environment mode - 'sandbox' uses isolated sandbox data */\n environment?: 'production' | 'sandbox';\n}\n\n// ============================================================================\n// React Hook Types\n// ============================================================================\n\n/** Base hook state with loading and error */\ninterface BaseHookState {\n loading: boolean;\n error: Error | null;\n}\n\n/** Base options for hooks with auto-fetch capability */\ninterface BaseAutoFetchOptions {\n autoFetch?: boolean;\n}\n\n/** Base options for hooks with polling capability */\ninterface BasePollOptions extends BaseAutoFetchOptions {\n pollInterval?: number;\n}\n\n/** Base options for list hooks with filters and pagination */\ninterface BaseListOptions<TFilters> extends BasePollOptions {\n filters?: TFilters;\n pagination?: PaginationParams;\n}\n\nexport interface UseKycSubmissionOptions {\n onComplete?: (result: DocumentVerificationResponse) => void;\n onError?: (error: Error) => void;\n}\n\nexport interface UseKycSubmissionResult extends BaseHookState {\n submit: (request: DocumentVerificationRequest) => Promise<DocumentVerificationResponse>;\n submission: DocumentVerificationResponse | null;\n reset: () => void;\n}\n\nexport type UseKycRequestsOptions = BaseListOptions<KycRequestFilters>;\n\nexport interface UseKycRequestsResult extends BaseHookState {\n requests: KycRequest[];\n pagination: KycPagination | null;\n fetchRequests: (filters?: KycRequestFilters, pagination?: PaginationParams) => Promise<void>;\n getRequest: (id: string) => Promise<KycRequest>;\n updateStatus: (reference: string, status: KycStatus, reason?: string) => Promise<void>;\n refresh: () => Promise<void>;\n}\n\nexport type UseKycAlertsOptions = BaseListOptions<KycAlertFilters>;\n\nexport interface UseKycAlertsResult extends BaseHookState {\n alerts: KycAlert[];\n pagination: KycPagination | null;\n fetchAlerts: (filters?: KycAlertFilters, pagination?: PaginationParams) => Promise<void>;\n getAlert: (id: string) => Promise<KycAlert>;\n updateAlert: (id: string, update: UpdateKycAlertRequest) => Promise<void>;\n refresh: () => Promise<void>;\n}\n\nexport interface UseKycOverviewOptions extends BaseAutoFetchOptions {\n fromDate?: string;\n toDate?: string;\n}\n\nexport interface UseKycOverviewResult extends BaseHookState {\n overview: KycOverview | null;\n refresh: (fromDate?: string, toDate?: string) => Promise<void>;\n}\n\nexport interface UseKycPreferencesResult extends BaseHookState {\n preferences: KycPreferences | null;\n updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;\n refresh: () => Promise<void>;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/core/errors.ts","../../src/core/circuit-breaker.ts","../../src/core/rate-limiter.ts","../../src/core/logger.ts","../../src/core/version.ts","../../src/shared/browser-utils.ts","../../src/core/client.ts","../../src/kyc/client.ts","../../src/kyc/types.ts"],"names":[],"mappings":";AAOO,IAAM,WAAA,GAAN,MAAM,YAAA,SAAoB,KAAA,CAAM;AAAA,EAGrC,WAAA,CACE,OAAA,EACO,IAAA,EACA,UAAA,EACA,OAAA,EACP;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAJN,IAAA,IAAA,C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,+BAAA,EAAkC,IAAA,CAAK,gBAAA,CAAiB,MAAM,CAAC,CAAA;AAAA,KACjE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcA,MAAM,mBAAmB,SAAA,EAA6C;AACpE,IAAA,OAAO,IAAA,CAAK,kBAAA;AAAA,MACV,mCAAmC,SAAS,CAAA;AAAA,KAC9C;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BA,MAAM,sBACJ,OAAA,EAC0B;AAC1B,IAAA,OAAO,IAAA,CAAK,mBAAoC,kBAAA,EAAoB;AAAA,MAClE,MAAA,EAAQ,MAAA;AAAA,MACR,IAAA,EAAM,IAAA,CAAK,SAAA,CAAU,OAAO;AAAA,KAC7B,CAAA;AAAA,EACH;AAAA;AAAA;AAAA;AAKF;;;AC9uBO,IAAM,yBAAA,GAA6D;AAAA,EACxE,oBAAA,EAAsB,oCAAA;AAAA,EACtB,oBAAA,EAAsB,8CAAA;AAAA,EACtB,iBAAA,EAAmB,uDAAA;AAAA,EACnB,mBAAA,EAAqB,yBAAA;AAAA,EACrB,sBAAA,EAAwB,+DAAA;AAAA,EACxB,oBAAA,EAAsB,6BAAA;AAAA,EACtB,iBAAA,EAAmB,qDAAA;AAAA,EACnB,qBAAA,EAAuB,iEAAA;AAAA,EACvB,YAAA,EAAc;AAChB","file":"index.mjs","sourcesContent":["/**\n * Error hierarchy for Vesant SDK\n *\n * Provides structured error handling with specific error types\n * for different failure scenarios.\n */\n\nexport class VesantError extends Error {\n public requestId?: string;\n\n constructor(\n message: string,\n public code: string,\n public statusCode?: number,\n public details?: Record<string, unknown>\n ) {\n super(message);\n this.name = 'VesantError';\n Object.setPrototypeOf(this, VesantError.prototype);\n }\n}\n\n/** @deprecated Use VesantError instead */\nexport const CGSError = VesantError;\n/** @deprecated Use VesantError instead */\nexport type CGSError = VesantError;\n\nexport class NetworkError extends VesantError {\n constructor(message: string, public originalError?: unknown) {\n super(message, 'NETWORK_ERROR');\n this.name = 'NetworkError';\n Object.setPrototypeOf(this, NetworkError.prototype);\n }\n}\n\nexport class ValidationError extends VesantError {\n constructor(message: string, fields?: string[]) {\n super(message, 'VALIDATION_ERROR', 400, { fields });\n this.name = 'ValidationError';\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport class ServiceUnavailableError extends VesantError {\n constructor(message: string = 'Service unavailable') {\n super(message, 'SERVICE_UNAVAILABLE', 503);\n this.name = 'ServiceUnavailableError';\n Object.setPrototypeOf(this, ServiceUnavailableError.prototype);\n }\n}\n\nexport class ComplianceBlockedError extends VesantError {\n constructor(reasons: import('./types').BlockReason[]) {\n super('Access blocked due to compliance rules', 'COMPLIANCE_BLOCKED', 403, { reasons });\n this.name = 'ComplianceBlockedError';\n Object.setPrototypeOf(this, ComplianceBlockedError.prototype);\n }\n}\n\nexport class AuthenticationError extends VesantError {\n constructor(message: string = 'Authentication failed') {\n super(message, 'AUTHENTICATION_ERROR', 401);\n this.name = 'AuthenticationError';\n Object.setPrototypeOf(this, AuthenticationError.prototype);\n }\n}\n\nexport class RateLimitError extends VesantError {\n constructor(public retryAfter?: number) {\n super('Rate limit exceeded', 'RATE_LIMIT_EXCEEDED', 429, { retryAfter });\n this.name = 'RateLimitError';\n Object.setPrototypeOf(this, RateLimitError.prototype);\n }\n}\n\nexport class TimeoutError extends VesantError {\n constructor(public timeout: number) {\n super(`Request timeout after ${timeout}ms`, 'TIMEOUT', 408, { timeout });\n this.name = 'TimeoutError';\n Object.setPrototypeOf(this, TimeoutError.prototype);\n }\n}\n\nexport class ComplianceError extends VesantError {\n constructor(\n message: string,\n public originalError?: unknown,\n code: string = 'COMPLIANCE_ERROR'\n ) {\n super(message, code);\n this.name = 'ComplianceError';\n Object.setPrototypeOf(this, ComplianceError.prototype);\n }\n}\n\nexport class CircuitBreakerOpenError extends VesantError {\n constructor() {\n super('Circuit breaker is open — requests are temporarily blocked', 'CIRCUIT_BREAKER_OPEN', 503);\n this.name = 'CircuitBreakerOpenError';\n Object.setPrototypeOf(this, CircuitBreakerOpenError.prototype);\n }\n}\n","/**\n * Circuit breaker pattern for resilient HTTP requests.\n *\n * States: closed (normal) -> open (failing) -> half-open (testing) -> closed\n */\n\nexport type CircuitBreakerState = 'closed' | 'open' | 'half-open';\n\nexport interface CircuitBreakerConfig {\n /** Number of consecutive failures before opening the circuit (default: 5) */\n failureThreshold?: number;\n /** Time in ms to wait before transitioning from open to half-open (default: 30000) */\n resetTimeout?: number;\n /** Number of successes in half-open state before closing (default: 1) */\n successThreshold?: number;\n}\n\nexport interface CircuitBreakerStatus {\n state: CircuitBreakerState;\n failures: number;\n successes: number;\n lastFailureTime: number | null;\n nextRetryTime: number | null;\n}\n\nexport class CircuitBreaker {\n private state: CircuitBreakerState = 'closed';\n private failures = 0;\n private successes = 0;\n private lastFailureTime: number | null = null;\n\n private readonly failureThreshold: number;\n private readonly resetTimeout: number;\n private readonly successThreshold: number;\n\n constructor(config: CircuitBreakerConfig = {}) {\n this.failureThreshold = config.failureThreshold ?? 5;\n this.resetTimeout = config.resetTimeout ?? 30000;\n this.successThreshold = config.successThreshold ?? 1;\n }\n\n /**\n * Check if a request can proceed through the circuit breaker.\n */\n canExecute(): boolean {\n if (this.state === 'closed') {\n return true;\n }\n\n if (this.state === 'open') {\n const now = Date.now();\n if (this.lastFailureTime && now - this.lastFailureTime >= this.resetTimeout) {\n this.state = 'half-open';\n this.successes = 0;\n return true;\n }\n return false;\n }\n\n // half-open: allow requests through for testing\n return true;\n }\n\n /**\n * Record a successful request.\n */\n onSuccess(): void {\n if (this.state === 'half-open') {\n this.successes++;\n if (this.successes >= this.successThreshold) {\n this.state = 'closed';\n this.failures = 0;\n this.successes = 0;\n this.lastFailureTime = null;\n }\n } else if (this.state === 'closed') {\n this.failures = 0;\n }\n }\n\n /**\n * Record a failed request.\n */\n onFailure(): void {\n this.failures++;\n this.lastFailureTime = Date.now();\n\n if (this.state === 'half-open') {\n this.state = 'open';\n this.successes = 0;\n } else if (this.state === 'closed' && this.failures >= this.failureThreshold) {\n this.state = 'open';\n }\n }\n\n /**\n * Get current circuit breaker status.\n */\n getStatus(): CircuitBreakerStatus {\n return {\n state: this.state,\n failures: this.failures,\n successes: this.successes,\n lastFailureTime: this.lastFailureTime,\n nextRetryTime:\n this.state === 'open' && this.lastFailureTime\n ? this.lastFailureTime + this.resetTimeout\n : null,\n };\n }\n\n /**\n * Reset the circuit breaker to its initial closed state.\n */\n reset(): void {\n this.state = 'closed';\n this.failures = 0;\n this.successes = 0;\n this.lastFailureTime = null;\n }\n}\n","/**\n * Rate limit tracking from API response headers.\n *\n * Tracks X-RateLimit-* headers to enable pre-flight checks\n * before making requests.\n */\n\nexport interface RateLimitStatus {\n /** Maximum requests allowed in the window */\n limit: number | null;\n /** Remaining requests in the current window */\n remaining: number | null;\n /** Unix timestamp (seconds) when the rate limit resets */\n reset: number | null;\n /** Seconds until the rate limit resets */\n retryAfter: number | null;\n}\n\nexport class RateLimitTracker {\n private limit: number | null = null;\n private remaining: number | null = null;\n private reset: number | null = null;\n private retryAfter: number | null = null;\n\n /**\n * Extract rate limit information from response headers.\n */\n updateFromHeaders(headers: Headers): void {\n const limit = headers.get('x-ratelimit-limit');\n const remaining = headers.get('x-ratelimit-remaining');\n const reset = headers.get('x-ratelimit-reset');\n const retryAfter = headers.get('retry-after');\n\n if (limit !== null) this.limit = parseInt(limit, 10);\n if (remaining !== null) this.remaining = parseInt(remaining, 10);\n if (reset !== null) this.reset = parseInt(reset, 10);\n if (retryAfter !== null) this.retryAfter = parseInt(retryAfter, 10);\n }\n\n /**\n * Check if the rate limit has been exceeded based on tracked headers.\n */\n isLimitExceeded(): boolean {\n if (this.remaining !== null && this.remaining <= 0) {\n // Check if the reset time has passed\n if (this.reset !== null) {\n const now = Math.floor(Date.now() / 1000);\n if (now >= this.reset) {\n // Reset window has passed, allow requests\n this.remaining = null;\n this.reset = null;\n this.retryAfter = null;\n return false;\n }\n }\n return true;\n }\n return false;\n }\n\n /**\n * Get current rate limit status.\n */\n getStatus(): RateLimitStatus {\n return {\n limit: this.limit,\n remaining: this.remaining,\n reset: this.reset,\n retryAfter: this.retryAfter,\n };\n }\n}\n","import type { Logger } from './config';\n\nexport function createConsoleLogger(): Logger {\n return {\n debug(message: string, meta?: Record<string, unknown>) {\n console.log(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n info(message: string, meta?: Record<string, unknown>) {\n console.info(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n warn(message: string, meta?: Record<string, unknown>) {\n console.warn(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n error(message: string, meta?: Record<string, unknown>) {\n console.error(`[Vesant SDK] ${message}`, meta !== undefined ? meta : '');\n },\n };\n}\n\nexport const noopLogger: Logger = {\n debug() {},\n info() {},\n warn() {},\n error() {},\n};\n","/**\n * Single source of truth for the SDK version.\n */\nexport const SDK_VERSION = '2.0.0';\n","/**\n * Shared browser utility functions.\n *\n * Extracted from ciphertext.ts and hooks.ts to avoid duplication.\n * All functions include SSR guards for safe server-side rendering.\n */\n\n/**\n * Generate a UUID v4\n */\nexport function generateUUID(): string {\n if (typeof crypto !== 'undefined' && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n\n // Fallback for older browsers\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Generate a unique device ID that persists across sessions.\n * Falls back to a random UUID when localStorage is unavailable (SSR).\n */\nexport function generateDeviceId(): string {\n if (typeof window === 'undefined' || typeof localStorage === 'undefined') {\n return generateUUID();\n }\n\n const storageKey = 'vesant_device_id';\n let deviceId = localStorage.getItem(storageKey);\n\n if (!deviceId) {\n deviceId = generateUUID();\n localStorage.setItem(storageKey, deviceId);\n }\n\n return deviceId;\n}\n\n/**\n * Detect browser information from user agent.\n * Returns safe defaults when running server-side.\n */\nexport function getBrowserInfo(): {\n browser: string;\n browser_version: string;\n os: string;\n os_version: string;\n} {\n if (typeof navigator === 'undefined') {\n return { browser: 'unknown', browser_version: '', os: 'unknown', os_version: '' };\n }\n\n const ua = navigator.userAgent;\n let browser = 'unknown';\n let browserVersion = '';\n let os = 'unknown';\n let osVersion = '';\n\n // Detect browser\n if (ua.includes('Firefox/')) {\n browser = 'Firefox';\n browserVersion = ua.match(/Firefox\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Edg/')) {\n browser = 'Edge';\n browserVersion = ua.match(/Edg\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Chrome/')) {\n browser = 'Chrome';\n browserVersion = ua.match(/Chrome\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Safari/') && !ua.includes('Chrome')) {\n browser = 'Safari';\n browserVersion = ua.match(/Version\\/([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('Opera') || ua.includes('OPR/')) {\n browser = 'Opera';\n browserVersion = ua.match(/(?:Opera|OPR)\\/([\\d.]+)/)?.[1] || '';\n }\n\n // Detect OS\n if (ua.includes('Windows')) {\n os = 'Windows';\n if (ua.includes('Windows NT 10.0')) osVersion = '10';\n else if (ua.includes('Windows NT 6.3')) osVersion = '8.1';\n else if (ua.includes('Windows NT 6.2')) osVersion = '8';\n else if (ua.includes('Windows NT 6.1')) osVersion = '7';\n } else if (ua.includes('Mac OS X')) {\n os = 'macOS';\n osVersion = ua.match(/Mac OS X ([\\d_]+)/)?.[1]?.replace(/_/g, '.') || '';\n } else if (ua.includes('Linux')) {\n os = 'Linux';\n } else if (ua.includes('Android')) {\n os = 'Android';\n osVersion = ua.match(/Android ([\\d.]+)/)?.[1] || '';\n } else if (ua.includes('iOS') || ua.includes('iPhone') || ua.includes('iPad')) {\n os = 'iOS';\n osVersion = ua.match(/OS ([\\d_]+)/)?.[1]?.replace(/_/g, '.') || '';\n }\n\n return { browser, browser_version: browserVersion, os, os_version: osVersion };\n}\n","/**\n * Base HTTP client for all Vesant SDK clients\n *\n * Provides common functionality:\n * - Request/response handling\n * - Error handling\n * - Retry logic with exponential backoff\n * - Timeout management\n * - Debug logging\n */\n\nimport type { BaseClientConfig, Logger, RequestInterceptor, RequestOptions } from './config';\nimport {\n VesantError,\n NetworkError,\n TimeoutError,\n AuthenticationError,\n RateLimitError,\n ServiceUnavailableError,\n ValidationError,\n CircuitBreakerOpenError,\n} from './errors';\nimport { CircuitBreaker, type CircuitBreakerStatus } from './circuit-breaker';\nimport { RateLimitTracker, type RateLimitStatus } from './rate-limiter';\nimport { createConsoleLogger } from './logger';\nimport { SDK_VERSION } from './version';\nimport { generateUUID } from '../shared/browser-utils';\n\nexport abstract class BaseClient {\n protected config: BaseClientConfig & { timeout: number; retries: number };\n protected logger: Logger;\n private interceptors: RequestInterceptor[];\n private circuitBreaker: CircuitBreaker | null = null;\n private rateLimitTracker: RateLimitTracker | null = null;\n\n constructor(config: BaseClientConfig) {\n if (!config.baseURL?.trim()) {\n throw new ValidationError('baseURL is required and must be a non-empty string', ['baseURL']);\n }\n if (!config.tenantId?.trim()) {\n throw new ValidationError('tenantId is required and must be a non-empty string', ['tenantId']);\n }\n\n this.interceptors = config.interceptors || [];\n this.logger = config.logger || createConsoleLogger();\n\n // Auto-detect environment from API key prefix\n let environment = config.environment;\n const apiKey = config.apiKey || '';\n if (apiKey.startsWith('pk_test_')) {\n if (environment === 'production') {\n this.logger.warn('Sandbox API key (pk_test_*) used with environment: \"production\" — overriding to \"sandbox\"');\n }\n environment = 'sandbox';\n } else if (apiKey.startsWith('pk_live_') && environment === 'sandbox') {\n this.logger.warn('Production API key (pk_live_*) used with environment: \"sandbox\" — sandbox isolation will still be applied for backward compatibility');\n }\n\n this.config = {\n ...config,\n apiKey,\n environment,\n headers: config.headers || {},\n timeout: config.timeout || 10000,\n retries: config.retries || 3,\n debug: config.debug || false,\n interceptors: this.interceptors,\n logger: this.logger,\n };\n\n if (config.circuitBreaker) {\n this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);\n }\n if (config.enableRateLimitTracking) {\n this.rateLimitTracker = new RateLimitTracker();\n }\n }\n\n /**\n * Make an HTTP request with timeout and error handling\n */\n protected async request<T>(\n endpoint: string,\n options: RequestInit = {},\n serviceURL?: string,\n requestOptions?: RequestOptions\n ): Promise<T> {\n const requestId = generateUUID();\n\n // Circuit breaker check\n if (this.circuitBreaker && !this.circuitBreaker.canExecute()) {\n const error = new CircuitBreakerOpenError();\n error.requestId = requestId;\n throw error;\n }\n\n // Rate limit pre-check\n if (this.rateLimitTracker && this.rateLimitTracker.isLimitExceeded()) {\n const status = this.rateLimitTracker.getStatus();\n const error = new RateLimitError(status.retryAfter ?? undefined);\n error.requestId = requestId;\n throw error;\n }\n\n const url = `${serviceURL || this.config.baseURL}${endpoint}`;\n\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'X-Tenant-ID': this.config.tenantId,\n 'X-SDK-Version': `vesant-sdk-ts/${SDK_VERSION}`,\n 'X-Request-ID': requestId,\n ...this.config.headers,\n ...((options.headers as Record<string, string>) || {}),\n };\n\n if (this.config.apiKey) {\n headers['Authorization'] = `Bearer ${this.config.apiKey}`;\n }\n\n // Sandbox header\n if (this.config.environment === 'sandbox') {\n headers['X-Sandbox'] = 'true';\n }\n\n // Idempotency key for mutating methods\n const method = (options.method || 'GET').toUpperCase();\n if (['POST', 'PUT', 'PATCH'].includes(method)) {\n headers['Idempotency-Key'] = requestOptions?.idempotencyKey || generateUUID();\n }\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);\n\n // Link consumer AbortSignal to internal controller\n if (requestOptions?.signal) {\n if (requestOptions.signal.aborted) {\n controller.abort();\n } else {\n requestOptions.signal.addEventListener('abort', () => controller.abort(), { once: true });\n }\n }\n\n try {\n // Run onRequest interceptors\n let finalOptions: RequestInit = { ...options, headers };\n for (const interceptor of this.interceptors) {\n if (interceptor.onRequest) {\n finalOptions = await interceptor.onRequest(url, finalOptions);\n }\n }\n\n if (this.config.debug) {\n this.logger.debug(`${finalOptions.method || 'GET'} ${endpoint}`);\n }\n\n const response = await fetch(url, {\n ...finalOptions,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n // Track rate limit headers\n if (this.rateLimitTracker) {\n this.rateLimitTracker.updateFromHeaders(response.headers);\n }\n\n // Binary download path\n if (requestOptions?.responseType === 'arraybuffer') {\n if (!response.ok) {\n let errData: Record<string, unknown> = {};\n try { errData = await response.json(); } catch { /* ignore */ }\n this.handleErrorResponse(response.status, errData, requestId);\n }\n this.circuitBreaker?.onSuccess();\n const buffer = await response.arrayBuffer();\n return buffer as unknown as T;\n }\n\n let data: Record<string, unknown> | undefined;\n try {\n data = await response.json();\n } catch {\n // Non-JSON response (HTML error pages, 204 No Content, etc.)\n if (!response.ok) {\n this.handleErrorResponse(response.status, {\n error: `HTTP ${response.status}`,\n message: response.statusText,\n }, requestId);\n }\n // OK response but no JSON body (e.g., 204)\n this.circuitBreaker?.onSuccess();\n return undefined as unknown as T;\n }\n\n if (!response.ok) {\n this.handleErrorResponse(response.status, data || {}, requestId);\n }\n\n // Record success for circuit breaker\n this.circuitBreaker?.onSuccess();\n\n // Run onResponse interceptors\n let result: unknown = data;\n for (const interceptor of this.interceptors) {\n if (interceptor.onResponse) {\n result = await interceptor.onResponse(url, result);\n }\n }\n\n if (this.config.debug) {\n this.logger.debug(`Response: ${response.status}`);\n }\n\n return result as T;\n } catch (error) {\n clearTimeout(timeoutId);\n\n // Record failure for circuit breaker (skip for client errors)\n if (\n error instanceof VesantError &&\n error.statusCode &&\n error.statusCode >= 500\n ) {\n this.circuitBreaker?.onFailure();\n } else if (error instanceof NetworkError || error instanceof TimeoutError) {\n this.circuitBreaker?.onFailure();\n }\n\n // Attach requestId to VesantError instances\n if (error instanceof VesantError && !error.requestId) {\n error.requestId = requestId;\n }\n\n // Run onError interceptors\n if (error instanceof Error) {\n for (const interceptor of this.interceptors) {\n if (interceptor.onError) {\n await interceptor.onError(url, error);\n }\n }\n }\n\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n // Distinguish consumer abort from timeout\n if (requestOptions?.signal?.aborted) {\n const abortError = new VesantError('Request aborted', 'REQUEST_ABORTED');\n abortError.requestId = requestId;\n throw abortError;\n }\n this.circuitBreaker?.onFailure();\n const timeoutError = new TimeoutError(this.config.timeout);\n timeoutError.requestId = requestId;\n throw timeoutError;\n }\n if (error instanceof VesantError) {\n throw error;\n }\n }\n\n const networkError = new NetworkError('Network request failed', error);\n networkError.requestId = requestId;\n this.circuitBreaker?.onFailure();\n throw networkError;\n }\n }\n\n /**\n * Make an HTTP request with retry logic\n */\n protected async requestWithRetry<T>(\n endpoint: string,\n options: RequestInit = {},\n serviceURL?: string,\n retries: number = this.config.retries,\n requestOptions?: RequestOptions\n ): Promise<T> {\n let lastError: Error | undefined;\n\n for (let attempt = 0; attempt <= retries; attempt++) {\n try {\n return await this.request<T>(endpoint, options, serviceURL, requestOptions);\n } catch (error) {\n lastError = error instanceof Error ? error : new Error('Unknown error');\n\n // Don't retry on consumer abort\n if (requestOptions?.signal?.aborted) {\n throw lastError;\n }\n\n // Don't retry on client errors (4xx), except 429 (rate limit)\n if (\n lastError instanceof VesantError &&\n lastError.statusCode &&\n lastError.statusCode >= 400 &&\n lastError.statusCode < 500 &&\n lastError.statusCode !== 429\n ) {\n throw lastError;\n }\n\n // Don't retry on last attempt\n if (attempt === retries) {\n break;\n }\n\n // Use Retry-After for 429, otherwise exponential backoff with jitter\n let delay: number;\n if (lastError instanceof RateLimitError && lastError.retryAfter) {\n delay = lastError.retryAfter * 1000;\n } else {\n delay = Math.min(1000 * Math.pow(2, attempt) + Math.random() * 1000, 10000);\n }\n await new Promise((resolve) => setTimeout(resolve, delay));\n\n if (this.config.debug) {\n this.logger.debug(`Retry attempt ${attempt + 1}/${retries} after ${delay.toFixed(0)}ms`);\n }\n }\n }\n\n throw new NetworkError(`Request failed after ${retries} retries`, lastError);\n }\n\n /**\n * Handle error responses from API\n */\n protected handleErrorResponse(status: number, data: Record<string, unknown>, requestId?: string): never {\n const message = (data.error as string) || (data.message as string) || `HTTP ${status}`;\n\n const createError = (): VesantError => {\n switch (status) {\n case 400:\n return new VesantError(message, 'BAD_REQUEST', 400);\n case 401:\n return new AuthenticationError(message);\n case 403:\n return new VesantError(message, 'FORBIDDEN', 403);\n case 404:\n return new VesantError(message, 'NOT_FOUND', 404);\n case 409:\n return new VesantError(message, 'DUPLICATE_PROFILE', 409);\n case 429: {\n const retryAfter = (data.retry_after as number | undefined) || (data.retryAfter as number | undefined);\n return new RateLimitError(retryAfter);\n }\n case 500:\n case 502:\n case 503:\n case 504:\n return new ServiceUnavailableError(message);\n default:\n return new VesantError(message, 'UNKNOWN_ERROR', status);\n }\n };\n\n const error = createError();\n if (requestId) {\n error.requestId = requestId;\n }\n throw error;\n }\n\n /**\n * Build query string from parameters\n */\n protected buildQueryString(params: Record<string, unknown>): string {\n const query = new URLSearchParams();\n\n Object.entries(params).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n if (Array.isArray(value)) {\n value.forEach((item) => query.append(key, String(item)));\n } else {\n query.append(key, String(value));\n }\n }\n });\n\n const queryString = query.toString();\n return queryString ? `?${queryString}` : '';\n }\n\n /**\n * Update client configuration\n */\n updateConfig(config: Partial<BaseClientConfig>): void {\n this.config = {\n ...this.config,\n ...config,\n headers: {\n ...this.config.headers,\n ...(config.headers || {}),\n },\n };\n if (config.logger) {\n this.logger = config.logger;\n }\n if (config.interceptors) {\n this.interceptors = config.interceptors;\n }\n }\n\n /**\n * Get current configuration (readonly)\n */\n getConfig(): Readonly<BaseClientConfig> {\n return { ...this.config };\n }\n\n /**\n * Get rate limit status from tracked response headers.\n */\n getRateLimitStatus(): RateLimitStatus | null {\n return this.rateLimitTracker?.getStatus() ?? null;\n }\n\n /**\n * Get circuit breaker status.\n */\n getCircuitBreakerStatus(): CircuitBreakerStatus | null {\n return this.circuitBreaker?.getStatus() ?? null;\n }\n\n /**\n * Health check endpoint\n */\n async healthCheck(): Promise<{ status: string; timestamp: string }> {\n return this.request('/api/v1/health');\n }\n}\n","/**\n * KycClient - TypeScript SDK for Vesant KYC (Know Your Customer) Service\n *\n * Provides type-safe methods to interact with the KYC service API.\n * Extends BaseClient for consistent retry logic, timeout handling, and error management.\n */\n\nimport { BaseClient } from '../core/client';\nimport { ValidationError } from '../core/errors';\nimport type { BaseClientConfig } from '../core/config';\nimport type {\n KycClientConfig,\n KycRequest,\n KycRequestFilters,\n KycRequestListResponse,\n DocumentVerificationRequest,\n DocumentVerificationResponse,\n UpdateKycStatusRequest,\n RequestAdditionalDocumentsRequest,\n RequestKycSubmitLinkRequest,\n RequestKycSubmitLinkResponse,\n CheckKycStatusRequest,\n CheckKycStatusResponse,\n ProofDownloadURL,\n KycOverview,\n KycAlert,\n KycAlertFilters,\n KycAlertListResponse,\n UpdateKycAlertRequest,\n KycPreferences,\n UpdateKycPreferencesRequest,\n PaginationParams,\n CustomerProfile,\n CustomerProfileFilters,\n CustomerProfileListResponse,\n CreateCustomerProfileRequest,\n CreateReuseKycSessionRequest,\n CreateReuseKycSessionResponse,\n SubmitReuseKycSessionRequest,\n ReuseKycCallback,\n KycHandoffSession,\n} from './types';\n\n/** Helper to add filter value to params, joining arrays with commas */\nfunction addFilterParam(\n params: Record<string, unknown>,\n key: string,\n value: string | string[] | undefined\n): void {\n if (value !== undefined) {\n params[key] = Array.isArray(value) ? value.join(',') : value;\n }\n}\n\n/** Helper to add simple filter values to params */\nfunction addSimpleParams(\n params: Record<string, unknown>,\n source: Record<string, unknown>,\n keys: string[]\n): void {\n for (const key of keys) {\n if (source[key] !== undefined) {\n params[key] = source[key];\n }\n }\n}\n\n/**\n * KycClient extends BaseClient for:\n * - Consistent retry logic with exponential backoff\n * - Unified error handling (VesantError, NetworkError, TimeoutError, etc.)\n * - Automatic timeout management\n * - Debug logging\n *\n * All KYC verification calls use requestWithRetry() to handle\n * transient failures gracefully.\n */\nexport class KycClient extends BaseClient {\n private userId?: string;\n private riskProfileBaseURL?: string;\n\n constructor(config: KycClientConfig) {\n // Convert KycClientConfig to BaseClientConfig\n const baseConfig: BaseClientConfig = {\n baseURL: config.baseURL,\n tenantId: config.tenantId,\n apiKey: config.apiKey,\n headers: config.headers,\n timeout: config.timeout,\n retries: 3, // Default retry count for KYC calls\n debug: config.debug,\n environment: config.environment,\n };\n super(baseConfig);\n this.userId = config.userId;\n this.riskProfileBaseURL = config.riskProfileBaseURL;\n }\n\n /**\n * Set the user ID for operations requiring user context\n */\n setUserId(userId: string): void {\n this.userId = userId;\n }\n\n /**\n * Get current user ID\n */\n getUserId(): string | undefined {\n return this.userId;\n }\n\n /**\n * Build headers including user ID if available\n */\n private getUserHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n if (this.userId) {\n headers['X-User-ID'] = this.userId;\n }\n return headers;\n }\n\n // ============================================================================\n // Document Verification\n // ============================================================================\n\n /**\n * Request a KYC submission redirect URL for a user\n *\n * Generates a link that the user can visit to submit their KYC documents.\n *\n * @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)\n * @returns Response containing the redirect link and KYC ID\n *\n * @example\n * ```typescript\n * const result = await client.requestKycSubmitLink({\n * user_id: \"user_123\",\n * redirect_url: \"https://merchant.com/kyc-complete\", // optional\n * callback_url: \"https://merchant.com/api/kyc-webhook\" // optional - receives POST requests on status change\n * });\n *\n * console.log(`Redirect user to: ${result.link}`);\n * console.log(`KYC ID: ${result.kyc_id}`);\n * ```\n */\n async requestKycSubmitLink(\n request: RequestKycSubmitLinkRequest\n ): Promise<RequestKycSubmitLinkResponse> {\n return this.requestWithRetry<RequestKycSubmitLinkResponse>('/api/v1/kyc/request', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Create a Re-Use KYC session.\n *\n * Inspect the response before showing UI:\n * - `is_required === false` → skip face capture; `reason` explains why.\n * - `device_type === 'desktop'` → render `qr_payload` as a QR; the\n * mobile device picks up the session via the connect endpoint.\n * - `device_type === 'mobile'` → open the face capture modal directly.\n *\n * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.\n */\n async createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse> {\n // One-shot: do NOT use requestWithRetry. Creating a session is a\n // non-idempotent POST that allocates server-side state (DB row + Redis\n // handoff). Retrying on timeout would create duplicate sessions and\n // burn Shufti references on the follow-up submit.\n return this.request<CreateReuseKycSessionResponse>('/api/v1/kyc/face/session', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Submit a real-time face capture for an active Re-Use KYC session.\n *\n * **Mobile-only.** The server rejects desktop User-Agents with HTTP\n * 400 (`face capture must be completed on a mobile device`). Use the\n * QR handoff from `createReuseKycSession` for desktop callers.\n *\n * The `data` field on the response carries `retries_remaining`,\n * `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,\n * `freeze_account`, etc.) so the tenant app can act on a final failure.\n *\n * @param request - Token from `createReuseKycSession`, plus the base64 selfie.\n */\n async submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<ReuseKycCallback> {\n // One-shot: do NOT use requestWithRetry. Submitting a selfie is a\n // non-idempotent POST — every call uploads to S3, calls Shufti\n // (billable), and increments the `attempts` counter on the session\n // row. Retries on transient errors would burn attempts and produce\n // multiple Shufti responses for one user action. Manual retries\n // (user clicks \"Try again\" in the modal) re-call this method\n // explicitly, which is the right surface for the retry decision.\n return this.request<ReuseKycCallback>('/api/v1/kyc/face/submit', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Look up the current state of a Re-Use KYC session by its forward\n * reference. Useful for desktop pollers waiting on the mobile handoff.\n *\n * @param reference - The reference used when the session was created.\n */\n async getReuseKycSessionStatus(reference: string): Promise<ReuseKycCallback> {\n return this.requestWithRetry<ReuseKycCallback>(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {\n method: 'GET',\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Fetch the Redis-backed handoff session for a token. Same backing\n * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop\n * callers poll `mobile_connected` to detect when a mobile device has\n * scanned the QR and attached.\n *\n * @param token - The session token returned by `createReuseKycSession`.\n */\n async getHandoffSession(token: string): Promise<KycHandoffSession> {\n return this.request<KycHandoffSession>(\n `/api/v1/kyc/session${this.buildQueryString({ token })}`,\n { headers: this.getUserHeaders() }\n );\n }\n\n /**\n * Attach a mobile device to a desktop-initiated session. The mobile\n * client calls this after scanning the QR code. The desktop poller\n * sees `mobile_connected: true` on the next `getHandoffSession`.\n *\n * @param token - The session token transferred via the QR payload.\n * @param isDisconnect - Pass true to release the session (default false).\n */\n async connectMobileSession(token: string, isDisconnect = false): Promise<{ mobile_connected: boolean }> {\n return this.request<{ mobile_connected: boolean }>('/api/v1/kyc/session/connect', {\n method: 'PUT',\n body: JSON.stringify({ token, is_disconnect: isDisconnect }),\n headers: this.getUserHeaders(),\n });\n }\n /**\n * Check KYC status for a user\n *\n * Returns the current KYC status:\n * - \"complete\" → KYC verified, show \"Continue to Login\"\n * - \"processing\" → Under review, show \"Continue to Login\"\n * - \"failed\" / \"declined\" → Show error + retry option\n * - \"pending\" / \"in_progress\" → Keep polling\n *\n * @param request - Request containing user_id and token\n * @returns Response with kyc_status and message (reason)\n *\n * @example\n * ```typescript\n * const result = await client.checkKycStatus({\n * user_id: \"user_123\",\n * token: \"auth_token_xyz\"\n * });\n *\n * if (result.kyc_status === 'complete') {\n * // Show \"Continue to Login\"\n * } else if (result.kyc_status === 'failed' || result.kyc_status === 'declined') {\n * // Show error + retry option\n * } else {\n * // Keep polling\n * }\n * ```\n */\n async checkKycStatus(\n request: CheckKycStatusRequest\n ): Promise<CheckKycStatusResponse> {\n const params = {\n user_id: request.user_id,\n kyc_id: request.kyc_id,\n };\n\n return this.requestWithRetry<CheckKycStatusResponse>(\n `/api/v1/kyc/request/status${this.buildQueryString(params)}`,\n {\n method: 'GET',\n headers: this.getUserHeaders(),\n }\n );\n }\n\n /**\n * Submit a document verification request with OCR\n *\n * Uses requestWithRetry() for automatic retry on transient failures.\n *\n * @param request - Document verification request with documents and customer info\n * @returns Verification response with status and reference\n *\n * @example\n * ```typescript\n * const result = await client.submitVerification({\n * reference: \"customer_123\",\n * email: \"customer@example.com\",\n * country: \"US\",\n * document: {\n * proof: base64EncodedImage,\n * selected_type: [\"id_card\", \"passport\"],\n * name: { first_name: \"John\", last_name: \"Doe\" },\n * dob: \"1990-01-15\"\n * },\n * face: {\n * proof: base64EncodedSelfie\n * }\n * });\n *\n * console.log(`Verification submitted: ${result.reference}`);\n * ```\n */\n async submitVerification(\n request: DocumentVerificationRequest\n ): Promise<DocumentVerificationResponse> {\n return this.requestWithRetry<DocumentVerificationResponse>('/api/v1/kyc/submit', {\n method: 'POST',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Get a KYC request by ID\n *\n * @param id - KYC request ID\n * @returns KYC request details including proofs and alerts\n *\n * @example\n * ```typescript\n * const kyc = await client.getKycRequest(\"kyc_abc123\");\n * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);\n * ```\n */\n async getKycRequest(id: string): Promise<KycRequest> {\n return this.request<KycRequest>(`/api/v1/kyc/requests/${id}`);\n }\n\n /**\n * List KYC requests with filters and pagination\n *\n * @param filters - Optional filters (status, search, date range)\n * @param pagination - Optional pagination (page, page_size)\n * @returns Paginated list of KYC requests\n *\n * @example\n * ```typescript\n * const requests = await client.listKycRequests(\n * { status: \"pending\", search: \"john\" },\n * { page: 1, page_size: 20 }\n * );\n * console.log(`Found ${requests.total} pending requests`);\n * ```\n */\n async listKycRequests(\n filters?: KycRequestFilters,\n pagination?: PaginationParams\n ): Promise<KycRequestListResponse> {\n const params: Record<string, unknown> = {};\n\n if (filters) {\n addFilterParam(params, 'status', filters.status);\n addSimpleParams(params, filters as unknown as Record<string, unknown>, ['search', 'fromDate', 'toDate', 'sortBy', 'order']);\n }\n\n if (pagination) {\n if (pagination.page) params.page = pagination.page;\n if (pagination.page_size) params.limit = pagination.page_size;\n }\n\n return this.request<KycRequestListResponse>(\n `/api/v1/kyc/requests${this.buildQueryString(params)}`,\n { headers: this.getUserHeaders() }\n );\n }\n\n /**\n * Update KYC request status (accept/decline)\n *\n * @param request - Status update request with reference, status, and reason\n *\n * @example\n * ```typescript\n * // Accept a KYC request\n * await client.updateKycStatus({\n * reference: \"shufti_ref_123\",\n * status: \"accepted\",\n * reason: \"All documents verified successfully\"\n * });\n *\n * // Decline a KYC request\n * await client.updateKycStatus({\n * reference: \"shufti_ref_456\",\n * status: \"declined\",\n * reason: \"Document expired\"\n * });\n * ```\n */\n async updateKycStatus(request: UpdateKycStatusRequest): Promise<void> {\n await this.request('/api/v1/kyc/status', {\n method: 'PUT',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Request additional documents from customer\n *\n * @param request - Request with KYC ID and document types needed\n *\n * @example\n * ```typescript\n * await client.requestAdditionalDocuments({\n * id: \"kyc_abc123\",\n * document_types: [\"address\", \"document_two\"],\n * message: \"Please provide proof of address and secondary ID\"\n * });\n * ```\n */\n async requestAdditionalDocuments(\n request: RequestAdditionalDocumentsRequest\n ): Promise<void> {\n await this.request('/api/v1/kyc/requests', {\n method: 'PUT',\n body: JSON.stringify(request),\n headers: this.getUserHeaders(),\n });\n }\n\n /**\n * Get downloadable URLs for KYC proofs/documents\n *\n * @param kycId - KYC request ID\n * @returns Array of proof download URLs with expiration\n *\n * @example\n * ```typescript\n * const proofs = await client.getProofDownloadURLs(\"kyc_abc123\");\n * proofs.forEach(proof => {\n * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);\n * });\n * ```\n */\n async getProofDownloadURLs(kycId: string): Promise<ProofDownloadURL[]> {\n return this.request<ProofDownloadURL[]>(\n `/api/v1/kyc/proofs/${kycId}`,\n { headers: this.getUserHeaders() }\n );\n }\n\n // ============================================================================\n // KYC Overview & Statistics\n // ============================================================================\n\n /**\n * Get KYC overview statistics\n *\n * @param fromDate - Optional start date (ISO 8601)\n * @param toDate - Optional end date (ISO 8601)\n * @returns KYC statistics including counts by status\n *\n * @example\n * ```typescript\n * const overview = await client.getOverview(\n * \"2024-01-01T00:00:00Z\",\n * \"2024-12-31T23:59:59Z\"\n * );\n * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);\n * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);\n * ```\n */\n async getOverview(fromDate?: string, toDate?: string): Promise<KycOverview> {\n const params: Record<string, unknown> = {};\n if (fromDate) params.fromDate = fromDate;\n if (toDate) params.toDate = toDate;\n\n return this.request<KycOverview>(\n `/api/v1/kyc/overview${this.buildQueryString(params)}`\n );\n }\n\n // ============================================================================\n // Alert Management\n // ============================================================================\n\n /**\n * Get a KYC alert by ID\n *\n * @param alertId - Alert ID\n * @returns Alert details\n */\n async getAlert(alertId: string): Promise<KycAlert> {\n return this.request<KycAlert>(`/api/v1/kyc/alerts/${alertId}`);\n }\n\n /**\n * List KYC alerts with filters and pagination\n *\n * @param filters - Optional filters (status, risk, alert_type, assigned_for, etc.)\n * @param pagination - Optional pagination (page, page_size)\n * @returns Paginated list of alerts\n *\n * @example\n * ```typescript\n * const alerts = await client.listAlerts(\n * {\n * status: [\"pending\", \"in_progress\"],\n * risk: \"critical\",\n * alert_type: \"kyc\"\n * },\n * { page: 1, page_size: 20 }\n * );\n * console.log(`Found ${alerts.total} alerts`);\n * ```\n */\n async listAlerts(\n filters?: KycAlertFilters,\n pagination?: PaginationParams\n ): Promise<KycAlertListResponse> {\n const params: Record<string, unknown> = {};\n\n if (filters) {\n // Array filters that need comma joining\n addFilterParam(params, 'kyc_id', filters.kyc_id);\n addFilterParam(params, 'alert_type', filters.alert_type);\n addFilterParam(params, 'assigned_for', filters.assigned_for);\n addFilterParam(params, 'status', filters.status);\n addFilterParam(params, 'risk', filters.risk);\n // Simple filters\n addSimpleParams(params, filters as unknown as Record<string, unknown>, ['search', 'fromDate', 'toDate', 'sort_by', 'order']);\n }\n\n if (pagination) {\n if (pagination.page) params.page = pagination.page;\n if (pagination.page_size) params.limit = pagination.page_size;\n }\n\n return this.request<KycAlertListResponse>(\n `/api/v1/kyc/alerts${this.buildQueryString(params)}`\n );\n }\n\n /**\n * Update a KYC alert\n *\n * @param alertId - Alert ID\n * @param update - Fields to update (status, assigned_for, reason, alert_type)\n *\n * @example\n * ```typescript\n * // Assign an alert\n * await client.updateAlert(\"alert_123\", {\n * assigned_for: \"analyst_user_id\",\n * status: \"in_progress\"\n * });\n *\n * // Resolve an alert\n * await client.updateAlert(\"alert_123\", {\n * status: \"resolved\",\n * reason: \"Customer verified via phone call\"\n * });\n *\n * // Escalate an alert\n * await client.updateAlert(\"alert_123\", {\n * status: \"escalated\",\n * assigned_for: \"manager_user_id\",\n * reason: \"Requires senior review - suspicious documents\"\n * });\n * ```\n */\n async updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void> {\n await this.request(`/api/v1/kyc/alerts/${alertId}`, {\n method: 'PUT',\n body: JSON.stringify(update),\n headers: this.getUserHeaders(),\n });\n }\n\n // ============================================================================\n // KYC Preferences\n // ============================================================================\n\n /**\n * Get KYC preferences for the tenant\n *\n * @returns KYC preferences configuration\n *\n * @example\n * ```typescript\n * const prefs = await client.getPreferences();\n * console.log(`Face verification required: ${prefs.is_face_verification_required}`);\n * console.log(`Required documents: ${prefs.required_document_count}`);\n * ```\n */\n async getPreferences(): Promise<KycPreferences> {\n return this.request<KycPreferences>('/api/v1/kyc/preferences');\n }\n\n /**\n * Update KYC preferences for the tenant\n *\n * @param update - Fields to update\n * @returns Updated preferences\n *\n * @example\n * ```typescript\n * await client.updatePreferences({\n * is_face_verification_required: true,\n * is_address_verification_required: true,\n * required_document_count: 2,\n * reasons: [\n * \"Documents verified\",\n * \"Identity confirmed\",\n * \"Address matched\"\n * ]\n * });\n * ```\n */\n async updatePreferences(\n update: UpdateKycPreferencesRequest\n ): Promise<KycPreferences> {\n return this.request<KycPreferences>('/api/v1/kyc/preferences', {\n method: 'PUT',\n body: JSON.stringify(update),\n });\n }\n\n // ============================================================================\n // Customer Profile Management (Risk Profile Service)\n // ============================================================================\n\n /**\n * Make a request to the Risk Profile Service\n * Uses riskProfileBaseURL if configured, otherwise falls back to baseURL\n */\n private async riskProfileRequest<T>(\n path: string,\n options: RequestInit = {}\n ): Promise<T> {\n if (!this.riskProfileBaseURL) {\n throw new ValidationError(\n 'Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.',\n ['riskProfileBaseURL']\n );\n }\n\n return this.request<T>(path, {\n ...options,\n headers: {\n ...this.getUserHeaders(),\n ...(options.headers as Record<string, string>),\n },\n }, this.riskProfileBaseURL);\n }\n\n /**\n * List customer profiles for the tenant\n *\n * @param filters - Optional filters (risk_category, entity_type, status, search, etc.)\n * @param pagination - Optional pagination (limit, offset)\n * @returns Paginated list of customer profiles\n *\n * @example\n * ```typescript\n * const profiles = await client.listCustomerProfiles(\n * { risk_category: 'high', entity_type: 'individual' },\n * { limit: 20, offset: 0 }\n * );\n * console.log(`Found ${profiles.total} profiles`);\n * profiles.profiles.forEach(p => console.log(p.customer_id, p.full_name));\n * ```\n */\n async listCustomerProfiles(\n filters?: CustomerProfileFilters,\n pagination?: { limit?: number; offset?: number }\n ): Promise<CustomerProfileListResponse> {\n const params: Record<string, unknown> = {};\n\n if (filters) {\n // Array filters (keep as arrays for this API)\n if (filters.risk_category) {\n params.risk_category = Array.isArray(filters.risk_category)\n ? filters.risk_category\n : [filters.risk_category];\n }\n if (filters.entity_type) {\n params.entity_type = Array.isArray(filters.entity_type)\n ? filters.entity_type\n : [filters.entity_type];\n }\n if (filters.status) {\n params.status = Array.isArray(filters.status)\n ? filters.status\n : [filters.status];\n }\n // Simple filters\n addSimpleParams(params, filters as unknown as Record<string, unknown>, [\n 'search', 'is_pep', 'has_sanctions', 'requires_edd', 'sort_by', 'sort_order'\n ]);\n }\n\n if (pagination) {\n addSimpleParams(params, pagination, ['limit', 'offset']);\n }\n\n return this.riskProfileRequest<CustomerProfileListResponse>(\n `/api/v1/risk-dashboard/profiles${this.buildQueryString(params)}`\n );\n }\n\n /**\n * Get a customer profile by ID\n *\n * @param profileId - The profile UUID\n * @returns Customer profile details\n *\n * @example\n * ```typescript\n * const profile = await client.getCustomerProfile('uuid-here');\n * console.log(`Customer: ${profile.full_name}, Risk: ${profile.risk_category}`);\n * ```\n */\n async getCustomerProfile(profileId: string): Promise<CustomerProfile> {\n return this.riskProfileRequest<CustomerProfile>(\n `/api/v1/risk-dashboard/profiles/${profileId}`\n );\n }\n\n /**\n * Create a new customer profile\n *\n * A customer profile must exist before submitting KYC verification.\n * The customer_id field will be used as the 'reference' in KYC submissions.\n *\n * @param profile - Customer profile data\n * @returns Created customer profile\n *\n * @example\n * ```typescript\n * const profile = await client.createCustomerProfile({\n * customer_id: 'cust_123',\n * entity_type: 'individual',\n * full_name: 'John Doe',\n * email_address: 'john@example.com',\n * country_of_residence: 'US'\n * });\n * console.log(`Created profile: ${profile.id}`);\n *\n * // Now you can submit KYC using the customer_id as reference\n * await client.submitVerification({\n * reference: profile.customer_id, // 'cust_123'\n * email: 'john@example.com',\n * // ... other fields\n * });\n * ```\n */\n async createCustomerProfile(\n profile: CreateCustomerProfileRequest\n ): Promise<CustomerProfile> {\n return this.riskProfileRequest<CustomerProfile>('/api/v1/profiles', {\n method: 'POST',\n body: JSON.stringify(profile),\n });\n }\n\n // ============================================================================\n // Utility Methods (inherited from BaseClient: healthCheck, updateConfig, getConfig, buildQueryString)\n // ============================================================================\n}\n","/**\n * TypeScript type definitions for Vesant KYC Service API\n *\n * These types match the Go API structures in:\n * - services/kyc-service/internal/domain/\n * - services/kyc-service/internal/service/\n * - services/kyc-service/internal/handler/\n */\n\nimport type { PaginationParams, RiskLevel, Reason } from '../core/types';\n\n// Re-export commonly used types from core\nexport type { PaginationParams, RiskLevel };\n\n// ============================================================================\n// KYC Status & Enumerations\n// ============================================================================\n\nexport type KycStatus = 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';\n\nexport type KycDeclinedCode =\n | 'KYC_DOCUMENT_EXPIRED'\n | 'KYC_DOCUMENT_INVALID'\n | 'KYC_FACE_MISMATCH'\n | 'KYC_AGE_REQUIREMENT'\n | 'KYC_DUPLICATE_IDENTITY'\n | 'KYC_ADDRESS_MISMATCH'\n | 'KYC_NAME_MISMATCH'\n | 'KYC_PROVIDER_REJECTED'\n | 'KYC_DECLINED';\n\nexport const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string> = {\n KYC_DOCUMENT_EXPIRED: 'The submitted document has expired',\n KYC_DOCUMENT_INVALID: 'The submitted document could not be verified',\n KYC_FACE_MISMATCH: 'Face verification did not match the identity document',\n KYC_AGE_REQUIREMENT: 'Age requirement not met',\n KYC_DUPLICATE_IDENTITY: 'This identity has already been verified under another account',\n KYC_ADDRESS_MISMATCH: 'Address verification failed',\n KYC_NAME_MISMATCH: 'Name on document does not match the registered name',\n KYC_PROVIDER_REJECTED: 'Identity verification was rejected by the verification provider',\n KYC_DECLINED: 'Identity verification was declined',\n};\n\nexport type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';\n\nexport type KycAlertType = 'kyc' | 'fraud';\n\nexport type DocumentType = 'id_card' | 'driving_license' | 'passport';\n\nexport type ProofType =\n | 'document'\n | 'document_two'\n | 'face'\n | 'address'\n | 'additional_document';\n\nexport type SupportedDocumentType = 'id_card' | 'passport' | 'driving_license';\n\n// ============================================================================\n// KYC Request Types\n// ============================================================================\n\nexport interface KycRequest {\n id: string;\n reference: string;\n forward_reference?: string;\n tenant_id: string;\n first_name: string;\n middle_name?: string;\n last_name: string;\n dob?: string;\n full_address?: string;\n email?: string;\n\n // Verification Status Flags\n id_verified: boolean;\n address_verified: boolean;\n face_verified: boolean;\n age_verified: boolean;\n\n // Overall Status\n status: KycStatus;\n location?: string;\n identity_hash?: string;\n\n // Preferences at time of submission\n required_document_count: number;\n supported_document_types?: SupportedDocumentType[];\n is_id_verification_required: boolean;\n is_face_verification_required: boolean;\n is_address_verification_required: boolean;\n is_age_verification_required: boolean;\n\n // URLs\n callback_url: string;\n redirect_url?: string;\n\n // Reasons & Warnings\n /** Structured decline reasons. Present when status is `declined` (and the\n * `structured_block_reasons` flag is enabled server-side). */\n declined_reasons?: Reason[];\n /** Structured, non-blocking warnings. */\n warning_reasons?: Reason[];\n /** @deprecated Use {@link declined_reasons}. Comma-joined message text. */\n declined_reason?: string;\n /** @deprecated Use the `code` on {@link declined_reasons}. */\n declined_code?: KycDeclinedCode;\n accepted_reason?: string;\n other_reason?: string;\n /** @deprecated Use {@link warning_reasons}. */\n warnings?: Record<string, Record<string, string>>;\n\n // Relationships\n proofs?: Proof[];\n alerts?: KycAlert[];\n risk_profile?: KycCustomerProfile;\n\n created_at: string;\n updated_at: string;\n}\n\nexport interface Proof {\n id: string;\n kyc_id: string;\n type: ProofType;\n document: string;\n document_number?: string;\n created_at: string;\n}\n\nexport interface ProofDownloadURL {\n type: ProofType;\n url: string;\n expires_at: string;\n}\n\n// ============================================================================\n// KYC Customer Profile (Risk Profile Reference)\n// ============================================================================\n\nexport interface KycCustomerProfile {\n id: string;\n tenant_id: string;\n customer_id: string;\n first_name?: string;\n last_name?: string;\n email?: string;\n risk_score: number;\n risk_level: RiskLevel;\n kyc_status?: string;\n pep_status?: boolean;\n sanctions_status?: boolean;\n created_at: string;\n updated_at: string;\n}\n\n// ============================================================================\n// KYC Alert Types\n// ============================================================================\n\nexport interface KycAlert {\n id: string;\n kyc_id: string;\n tenant_id: string;\n alert_type: KycAlertType;\n alert_text: string;\n risk: RiskLevel;\n assigned_for?: string;\n reason?: string;\n status: KycAlertStatus;\n created_at: string;\n updated_at: string;\n}\n\nexport interface KycAlertFilters {\n kyc_id?: string | string[];\n alert_type?: KycAlertType | KycAlertType[];\n assigned_for?: string | string[];\n status?: KycAlertStatus | KycAlertStatus[];\n risk?: RiskLevel | RiskLevel[];\n search?: string;\n fromDate?: string;\n toDate?: string;\n sort_by?: string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface KycAlertListResponse {\n alerts: KycAlert[];\n pagination: KycPagination;\n}\n\nexport interface UpdateKycAlertRequest {\n assigned_for?: string;\n reason?: string;\n alert_type?: KycAlertType;\n status?: KycAlertStatus;\n}\n\n// ============================================================================\n// KYC Preferences Types\n// ============================================================================\n\n/**\n * Threshold-gated trigger for transaction events. Each rule is\n * self-contained — there is no umbrella flag.\n *\n * - `enabled=false` → event blocked.\n * - `enabled=true`, `threshold=0` (or null/omitted) → every event of this\n * type triggers Re-Use KYC, regardless of amount.\n * - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.\n */\nexport interface ReuseKycThresholdTrigger {\n enabled: boolean;\n /** USD threshold; 0 / null / omitted means \"any amount\". */\n threshold: number;\n}\n\n/**\n * Rate-of-occurrence trigger (used by `high_frequency_betting`). The\n * tenant tells the server how many events have happened over how many\n * minutes via the request body (`event_count`, `event_window_minutes`);\n * the server triggers when `event_count >= count` AND\n * `event_window_minutes <= window_minutes`. Either bound of 0 means\n * \"don't enforce that bound\".\n */\nexport interface ReuseKycFrequencyTrigger {\n enabled: boolean;\n /** Minimum number of events; 0 / null / omitted means \"any count\". */\n count: number;\n /** Maximum lookback window in minutes; 0 / null / omitted means \"any window\". */\n window_minutes: number;\n}\n\n/** Events that can trigger Re-Use KYC for a tenant. */\nexport interface ReuseKycTriggers {\n // Account-sensitive events\n login: boolean;\n password_change: boolean;\n name_change: boolean;\n phone_number_change: boolean;\n two_factor_auth_change: boolean;\n new_device_or_location: boolean;\n device_fingerprint_change: boolean;\n payment_method_change: boolean;\n\n // Transaction events — each rule is self-contained; there is no\n // umbrella flag. To enable a transaction event, set its `enabled`\n // field to true (and configure the relevant threshold / count /\n // window). To disable, set `enabled` to false.\n deposit: ReuseKycThresholdTrigger;\n withdrawal: ReuseKycThresholdTrigger;\n large_bet_placement: ReuseKycThresholdTrigger;\n high_frequency_betting: ReuseKycFrequencyTrigger;\n account_balance_transfer: boolean;\n}\n\n/**\n * Reactions taken when a customer exhausts the Re-Use KYC retry limit.\n * `trigger_alert` is enforced by the server (creates a KYC alert);\n * `enforce_logout` and `freeze_account` are forwarded to the tenant app\n * via the callback `data` field for it to enforce.\n */\nexport interface ReuseKycReactions {\n /** Retries after the first attempt; total submissions = this + 1. */\n max_retry_attempts: number;\n trigger_alert: boolean;\n enforce_logout: boolean;\n freeze_account: boolean;\n freeze_duration_minutes: number;\n}\n\nexport interface KycPreferences {\n id: string;\n tenant_id: string;\n approve_kyc_reasons: string[];\n is_document_verification_required: boolean;\n is_face_verification_required: boolean;\n is_address_verification_required: boolean;\n is_age_verification_required: boolean;\n /** Master switch for the Re-Use KYC feature. */\n is_reuse_kyc_enabled?: boolean;\n min_age: number;\n max_age: number;\n required_document_count: number;\n critical_risk_score: number;\n high_risk_score: number;\n medium_risk_score: number;\n supported_document_types: SupportedDocumentType[];\n /** Per-event triggers for Re-Use KYC. */\n reuse_kyc_triggers?: ReuseKycTriggers;\n /** Retry / reaction policy for Re-Use KYC. */\n reuse_kyc_reactions?: ReuseKycReactions;\n created_at: string;\n updated_at: string;\n}\n\nexport interface UpdateKycPreferencesRequest {\n reasons?: string[];\n is_document_verification_required?: boolean;\n is_face_verification_required?: boolean;\n is_address_verification_required?: boolean;\n is_age_verification_required?: boolean;\n is_reuse_kyc_enabled?: boolean;\n min_age?: number;\n max_age?: number;\n required_document_count?: number;\n critical_risk_score?: number;\n high_risk_score?: number;\n medium_risk_score?: number;\n supported_document_types?: SupportedDocumentType[];\n /** Partial update — only the events present here are changed. */\n reuse_kyc_triggers?: Partial<ReuseKycTriggers>;\n /** Partial update — only the keys present here are changed. */\n reuse_kyc_reactions?: Partial<ReuseKycReactions>;\n}\n\n// ============================================================================\n// Document Verification Request Types\n// ============================================================================\n\nexport interface Name {\n first_name?: string;\n middle_name?: string;\n last_name?: string;\n full_name?: string;\n}\n\nexport interface SubmittedDocument {\n /** Base64 encoded document image */\n proof: string;\n /** Base64 additional document image (back side, etc.) */\n additional_proof?: string;\n /** Document number for search/verification */\n document_number?: string;\n /** Document types to verify against */\n selected_type?: DocumentType[];\n /** Extracted/provided name */\n name?: Name;\n /** Date of birth (YYYY-MM-DD) */\n dob?: string;\n /** Issue date (YYYY-MM-DD) */\n issue_date?: string;\n /** Expiry date (YYYY-MM-DD) */\n expiry_date?: string;\n /** Gender */\n gender?: string;\n}\n\nexport interface FaceProof {\n /** Base64 encoded face image or selfie */\n proof: string;\n}\n\nexport interface DocumentVerificationRequest {\n /** Customer reference ID */\n reference: string;\n /** Callback URL for async verification results */\n callback_url: string;\n /** Customer email */\n email: string;\n /** Country code (ISO 3166-1 alpha-2) */\n country: string;\n /** Language code */\n language: string;\n /** Full address for verification */\n full_address?: string;\n /** Base64 encoded address proof document */\n address_proof?: string;\n /** Primary document */\n document: SubmittedDocument;\n /** Secondary document (optional) */\n document_two?: SubmittedDocument;\n /** Face verification proof (optional) */\n face?: FaceProof;\n /** Additional metadata */\n token?: string;\n}\n\nexport interface DocumentVerificationResponse {\n id: string;\n reference: string;\n status: KycStatus;\n verification_url?: string;\n message?: string;\n}\n\n// ============================================================================\n// KYC Status Update Types\n// ============================================================================\n\nexport interface UpdateKycStatusRequest {\n /** Shufti reference or KYC ID */\n reference: string;\n /** Target status */\n status: KycStatus;\n /** Acceptance/decline reason */\n reason?: string;\n /** Shufti warnings data */\n warnings?: Record<string, Record<string, string>>;\n}\n\n// ============================================================================\n// KYC Submit Link Request Types\n// ============================================================================\n\nexport interface RequestKycSubmitLinkRequest {\n /** User ID to generate KYC submission link for */\n user_id: string;\n /** URL to redirect user after KYC submission (optional) */\n redirect_url?: string;\n /** URL to receive callback notifications via POST request when KYC status changes (optional) */\n callback_url?: string;\n /** Event that triggered the KYC request (e.g. \"onboarding\", \"login\", \"transaction\") */\n trigger_event?: string;\n}\n\n/**\n * Trigger events that can request Re-Use KYC.\n *\n * Account-sensitive: any sensitive change to the account profile.\n * Transaction events: covered by the per-event rules in\n * `ReuseKycTriggers` (`deposit`, `withdrawal`, `large_bet_placement`,\n * `high_frequency_betting`, `account_balance_transfer`).\n */\nexport type ReuseKycEvent =\n | 'login'\n | 'password_change'\n | 'name_change'\n | 'phone_number_change'\n | 'two_factor_auth_change'\n | 'new_device_or_location'\n | 'device_fingerprint_change'\n | 'payment_method_change'\n | 'deposit'\n | 'withdrawal'\n | 'large_bet_placement'\n | 'high_frequency_betting'\n | 'account_balance_transfer';\n\nexport interface CreateReuseKycSessionRequest {\n /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */\n reference: string;\n /** Customer ID to associate with the KYC session */\n customer_id: string;\n /**\n * The triggering event. One of the `ReuseKycEvent` union members.\n * Required — when empty, the server falls through to the unknown-event\n * passthrough and allows the request silently.\n */\n event: ReuseKycEvent;\n /**\n * USD amount associated with the event. Required for threshold-gated\n * events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for\n * everything else. Missing/zero with a non-zero threshold blocks the\n * session.\n */\n amount?: number;\n /**\n * Number of qualifying events the customer has performed in the\n * window described by `event_window_minutes`. Required for\n * frequency-gated events (`high_frequency_betting`); ignored for\n * everything else.\n */\n event_count?: number;\n /**\n * Lookback window (in minutes) the tenant counted `event_count` over.\n * Required for frequency-gated events alongside `event_count`. A\n * window larger than the tenant's configured `window_minutes`\n * implies a slower rate than \"high frequency\" and blocks the session.\n */\n event_window_minutes?: number;\n /** URL to redirect user after validate the facial submission (optional) */\n redirect_url?: string;\n /** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */\n callback_url?: string;\n}\n\nexport interface SubmitReuseKycSessionRequest {\n /** Reuse KYC session token generated from createReuseKycSession */\n token: string;\n /** Base64 encoded face image or selfie for verification */\n proof: string;\n /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */\n reference?: string;\n}\n\nexport interface RequestKycSubmitLinkResponse {\n /** Generated KYC submission redirect URL */\n link: string;\n /** KYC request ID */\n kyc_id: string;\n}\n\n/** Device class detected by the SDK (purely client-side — server doesn't care). */\nexport type ReuseKycDeviceType = 'mobile' | 'desktop';\n\nexport interface CreateReuseKycSessionResponse {\n /** Reuse KYC session reference (echo of the request reference) */\n reference: string;\n /** Generated reuse KYC session token, valid 10 minutes */\n token: string;\n /**\n * Empty string when Re-Use KYC is required. When `is_required` is\n * false, this contains the human-readable reason (e.g. feature\n * disabled, threshold not met, customer has no prior KYC).\n */\n reason: string;\n /** Whether the caller must complete the face capture before proceeding */\n is_required: boolean;\n /**\n * Public HTTPS handoff URL the SDK encodes into a QR code on desktop.\n * The mobile device scans it, lands on the tenant frontend's\n * /reuse-kyc-submit page, and completes the face capture there. Empty\n * when the server has no `BASE_URL_FRONTEND` configured — the SDK\n * falls back to building its own URL in that case.\n */\n link: string;\n /** Failed face-capture attempts so far on this session. 0 on a fresh session. */\n attempts: number;\n /**\n * Total submissions permitted before reactions fire\n * (`reuse_kyc_reactions.max_retry_attempts + 1`).\n */\n max_attempts: number;\n}\n\n/**\n * Reaction outcome returned on every face-submit callback. Tenant apps\n * use this to decide whether to allow another retry, end the session,\n * or freeze the account. Reaction flags are only populated when\n * `retry_limit_exceeded` is true.\n */\nexport interface ReuseKycReactionResult {\n /** Submissions the customer still has before the retry limit fires. */\n retries_remaining: number;\n /** True once the latest failed attempt exhausts the retry policy. */\n retry_limit_exceeded: boolean;\n trigger_alert: boolean;\n enforce_logout: boolean;\n freeze_account: boolean;\n freeze_duration_minutes: number;\n /** Set when an alert was raised on the dashboard. */\n alert_id?: string;\n}\n\n/**\n * Shape of the webhook body POSTed to `callback_url` after a Re-Use KYC\n * submission completes (also returned synchronously from\n * `submitReuseKycSession`).\n */\nexport interface ReuseKycCallback {\n event: 'reuse_kyc';\n reference: string;\n resource_id: string;\n status: KycStatus;\n /** Structured decline reasons (present when the `structured_block_reasons`\n * flag is enabled server-side). */\n declined_reasons?: Reason[];\n /** @deprecated Use {@link declined_reasons}. */\n declined_reason?: string;\n /** @deprecated Use structured reasons. */\n warnings?: Record<string, Record<string, string>>;\n data: ReuseKycReactionResult;\n}\n\n/**\n * Server-side handoff session backed by Redis (TTL: 15 minutes). Shared\n * with the normal KYC mobile/desktop handoff. Desktop clients poll this\n * to detect when a mobile device has attached to the same token via QR.\n */\nexport interface KycHandoffSession {\n document: string;\n document_backside: string;\n document_two: string;\n document_two_backside: string;\n address: string;\n face: string;\n /** True after a mobile device hits PUT /api/v1/kyc/session/connect. */\n mobile_connected: boolean;\n /** True after the (normal-KYC) document submission completes; unused for Re-Use KYC. */\n is_submitted: boolean;\n}\n\n// ============================================================================\n// KYC Status Check Types\n// ============================================================================\n\nexport interface CheckKycStatusRequest {\n /** User ID to check KYC status for */\n user_id: string;\n /** Authentication token */\n kyc_id: string;\n}\n\n/**\n * Response from checkKycStatus. Always returns the same shape.\n *\n * `additional_data` is `null` when `status === 'pending'`.\n * When `status !== 'pending'`, `additional_data` contains the full KYC record\n * including document details, proofs, and the customer's risk profile.\n */\nexport interface CheckKycStatusResponse {\n id: string;\n forward_reference: string;\n status: KycStatus;\n id_verified: boolean;\n address_verified: boolean;\n face_verified: boolean;\n age_verified: boolean;\n /** Structured decline reasons. Present when status is `declined` (and the\n * `structured_block_reasons` flag is enabled server-side). */\n declined_reasons?: Reason[];\n /** Structured, non-blocking warnings. */\n warning_reasons?: Reason[];\n /** @deprecated Use {@link declined_reasons}. */\n declined_reason?: string;\n /** @deprecated Use the `code` on {@link declined_reasons}. */\n declined_code?: KycDeclinedCode;\n other_reason?: string;\n accepted_reason?: string;\n /** @deprecated Use {@link warning_reasons}. */\n warnings?: Record<string, Record<string, string>>;\n required_document_count: number;\n supported_document_types?: SupportedDocumentType[];\n is_id_verification_required: boolean;\n is_face_verification_required: boolean;\n is_address_verification_required: boolean;\n is_age_verification_required: boolean;\n created_at: string;\n /** Full KYC record with document details, proofs, and risk profile. Null when status is 'pending'. */\n additional_data: KycRequest | null;\n}\n\nexport interface RequestAdditionalDocumentsRequest {\n /** KYC request ID */\n id: string;\n /** Document types to request */\n document_types: ProofType[];\n /** Message to customer */\n message?: string;\n}\n\n// ============================================================================\n// KYC Overview & Statistics Types\n// ============================================================================\n\nexport interface KycOverview {\n total: number;\n pending: number;\n approved: number;\n high_risk: number;\n rejected: number;\n id_verified: number;\n address_verified: number;\n face_verified: number;\n rejections: number;\n total_alerts: number;\n pending_alerts: number;\n resolved_alerts: number;\n}\n\n// ============================================================================\n// KYC Request Listing Types\n// ============================================================================\n\nexport interface KycRequestFilters {\n status?: KycStatus | KycStatus[];\n search?: string;\n fromDate?: string;\n toDate?: string;\n sortBy?: string;\n order?: 'ASC' | 'DESC';\n}\n\nexport interface KycPagination {\n limit: number;\n page: number;\n total: number;\n totalPages: number;\n}\n\nexport interface KycRequestListResponse {\n data: KycRequest[];\n pagination: KycPagination;\n}\n\n// ============================================================================\n// Customer Profile Types (Re-exported from risk-profile module)\n// ============================================================================\n\n// Import types from risk-profile module for use in KYC client\nimport type {\n CustomerProfile as RiskProfileCustomerProfile,\n CreateProfileRequest,\n ProfileFilters,\n ProfileListResponse,\n} from '../risk-profile/types';\n\n// Export types for internal use in KYC client (aliased to avoid conflicts with main exports)\n// Users should import CustomerProfile, CreateProfileRequest, etc. from 'vesant-sdk/risk-profile'\nexport type {\n RiskProfileCustomerProfile as CustomerProfile,\n CreateProfileRequest as CreateCustomerProfileRequest,\n ProfileFilters as CustomerProfileFilters,\n ProfileListResponse as CustomerProfileListResponse,\n};\n\n// ============================================================================\n// SDK Configuration Types\n// ============================================================================\n\nexport interface KycClientConfig {\n /** Base URL of the KYC Service API (e.g., \"http://localhost:8088\") */\n baseURL: string;\n\n /** Base URL of the Customer Risk Profile Service API (e.g., \"http://localhost:8094\") */\n riskProfileBaseURL?: string;\n\n /** Tenant ID for multi-tenancy */\n tenantId: string;\n\n /** API key or JWT token for authentication */\n apiKey?: string;\n\n /** User ID for operations requiring user context */\n userId?: string;\n\n /** Custom headers to include in every request */\n headers?: Record<string, string>;\n\n /** Request timeout in milliseconds (default: 10000) */\n timeout?: number;\n\n /** Enable debug logging */\n debug?: boolean;\n\n /** Environment mode - 'sandbox' uses isolated sandbox data */\n environment?: 'production' | 'sandbox';\n}\n\n// ============================================================================\n// React Hook Types\n// ============================================================================\n\n/** Base hook state with loading and error */\ninterface BaseHookState {\n loading: boolean;\n error: Error | null;\n}\n\n/** Base options for hooks with auto-fetch capability */\ninterface BaseAutoFetchOptions {\n autoFetch?: boolean;\n}\n\n/** Base options for hooks with polling capability */\ninterface BasePollOptions extends BaseAutoFetchOptions {\n pollInterval?: number;\n}\n\n/** Base options for list hooks with filters and pagination */\ninterface BaseListOptions<TFilters> extends BasePollOptions {\n filters?: TFilters;\n pagination?: PaginationParams;\n}\n\nexport interface UseKycSubmissionOptions {\n onComplete?: (result: DocumentVerificationResponse) => void;\n onError?: (error: Error) => void;\n}\n\nexport interface UseKycSubmissionResult extends BaseHookState {\n submit: (request: DocumentVerificationRequest) => Promise<DocumentVerificationResponse>;\n submission: DocumentVerificationResponse | null;\n reset: () => void;\n}\n\nexport type UseKycRequestsOptions = BaseListOptions<KycRequestFilters>;\n\nexport interface UseKycRequestsResult extends BaseHookState {\n requests: KycRequest[];\n pagination: KycPagination | null;\n fetchRequests: (filters?: KycRequestFilters, pagination?: PaginationParams) => Promise<void>;\n getRequest: (id: string) => Promise<KycRequest>;\n updateStatus: (reference: string, status: KycStatus, reason?: string) => Promise<void>;\n refresh: () => Promise<void>;\n}\n\nexport type UseKycAlertsOptions = BaseListOptions<KycAlertFilters>;\n\nexport interface UseKycAlertsResult extends BaseHookState {\n alerts: KycAlert[];\n pagination: KycPagination | null;\n fetchAlerts: (filters?: KycAlertFilters, pagination?: PaginationParams) => Promise<void>;\n getAlert: (id: string) => Promise<KycAlert>;\n updateAlert: (id: string, update: UpdateKycAlertRequest) => Promise<void>;\n refresh: () => Promise<void>;\n}\n\nexport interface UseKycOverviewOptions extends BaseAutoFetchOptions {\n fromDate?: string;\n toDate?: string;\n}\n\nexport interface UseKycOverviewResult extends BaseHookState {\n overview: KycOverview | null;\n refresh: (fromDate?: string, toDate?: string) => Promise<void>;\n}\n\nexport interface UseKycPreferencesResult extends BaseHookState {\n preferences: KycPreferences | null;\n updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;\n refresh: () => Promise<void>;\n}\n"]}
|
package/dist/react.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult } 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-
|
|
1
|
+
import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, W as UseGeolocationOptions, X as UseGeolocationResult, Y as UseLocationCaptureOptions, Z as UseLocationCaptureResult, _ as UseLocationRequestsOptions, $ as UseLocationRequestsResult } from './client-BwkGrRW9.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-Dq0NMaXT.mjs';
|
|
3
3
|
import { RiskProfileClient } from './risk-profile/index.mjs';
|
|
4
|
-
import { C as CustomerProfile } from './types-
|
|
5
|
-
import { KycClient, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult,
|
|
4
|
+
import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
|
|
5
|
+
import { KycClient, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult, CreateReuseKycSessionRequest, CreateReuseKycSessionResponse, ReuseKycCallback } from './kyc/index.mjs';
|
|
6
6
|
import './client-BolQlL5e.mjs';
|
|
7
|
-
import './types-
|
|
7
|
+
import './types-CBQRNL-l.mjs';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Detect browser information from user agent.
|
|
@@ -507,8 +507,43 @@ declare function getStatusColor(status: string): string;
|
|
|
507
507
|
* @returns CSS color class or hex color
|
|
508
508
|
*/
|
|
509
509
|
declare function getRiskColor(risk: string): string;
|
|
510
|
+
/**
|
|
511
|
+
* Hook for the Re-Use KYC face-capture flow.
|
|
512
|
+
*
|
|
513
|
+
* Returns helpers that cover both mobile (direct capture) and desktop
|
|
514
|
+
* (QR + polling) modes. Device detection happens here on the client —
|
|
515
|
+
* the server accepts submissions from any User-Agent.
|
|
516
|
+
*
|
|
517
|
+
* - `startSession(req)` — POST /face/session. Inspect `is_required` first;
|
|
518
|
+
* skip the modal entirely when it's `false`.
|
|
519
|
+
* - `verifyFace(session, opts?)` — mount FaceCaptureModal and resolve once
|
|
520
|
+
* the user reaches a terminal state (accepted / declined-after-max /
|
|
521
|
+
* cancelled). The modal handles the device picker, QR handoff,
|
|
522
|
+
* selfie capture, retries within the configured `max_attempts`, and
|
|
523
|
+
* surfacing of the decline reason — all without unmounting in between.
|
|
524
|
+
* - `runFlow(req, opts?)` — convenience wrapper: `startSession` then
|
|
525
|
+
* `verifyFace`, with a short-circuit when `is_required` is false.
|
|
526
|
+
*/
|
|
510
527
|
declare function useReuseKYCSubmission(client: KycClient): {
|
|
511
|
-
|
|
528
|
+
startSession: (request: CreateReuseKycSessionRequest) => Promise<CreateReuseKycSessionResponse>;
|
|
529
|
+
verifyFace: (session: CreateReuseKycSessionResponse, opts?: {
|
|
530
|
+
defaultDevice?: "ask" | "this" | "mobile";
|
|
531
|
+
renderQR?: (payload: string) => React.ReactNode;
|
|
532
|
+
}) => Promise<ReuseKycCallback | null>;
|
|
533
|
+
runFlow: (request: CreateReuseKycSessionRequest, opts?: {
|
|
534
|
+
defaultDevice?: "ask" | "this" | "mobile";
|
|
535
|
+
renderQR?: (payload: string) => React.ReactNode;
|
|
536
|
+
}) => Promise<{
|
|
537
|
+
kind: "not_required";
|
|
538
|
+
session: CreateReuseKycSessionResponse;
|
|
539
|
+
} | {
|
|
540
|
+
kind: "cancelled";
|
|
541
|
+
session: CreateReuseKycSessionResponse;
|
|
542
|
+
} | {
|
|
543
|
+
kind: "completed";
|
|
544
|
+
session: CreateReuseKycSessionResponse;
|
|
545
|
+
result: ReuseKycCallback;
|
|
546
|
+
}>;
|
|
512
547
|
};
|
|
513
548
|
|
|
514
549
|
export { type UseCustomerProfileOptions, type UseCustomerProfileResult, UseGeolocationOptions, UseGeolocationResult, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult, UseLocationCaptureOptions, UseLocationCaptureResult, UseLocationRequestsOptions, UseLocationRequestsResult, type UseLoginVerificationOptions, type UseLoginVerificationResult, type UseRegistrationOptions, type UseRegistrationResult, type UseTransactionVerificationOptions, type UseTransactionVerificationResult, createDeviceFingerprint, fileToBase64, formatKycStatus, getBrowserInfo, getRiskColor, getStatusColor, isValidFileSize, isValidFileType, useCipherText, useCustomerProfile, useGeolocation, useKycAlerts, useKycOverview, useKycPreferences, useKycRequests, useKycSubmission, useLocationCapture, useLocationRequests, useLoginVerification, useRegistration, useReuseKYCSubmission, useTransactionVerification };
|