vesant-sdk 1.6.6 → 1.7.0-dev.e0ee6d5

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.
Files changed (86) hide show
  1. package/README.md +14 -4
  2. package/dist/{client-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
  3. package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
  4. package/dist/client-C3DCmGe9.d.ts +436 -0
  5. package/dist/{client-C_A7QLcB.d.ts → client-DMIRx7Tu.d.mts} +5 -3
  6. package/dist/{client-BlCxjbY2.d.mts → client-DoMSYMMR.d.ts} +5 -3
  7. package/dist/client-ZNdnpWe7.d.mts +436 -0
  8. package/dist/compliance/index.d.mts +25 -429
  9. package/dist/compliance/index.d.ts +25 -429
  10. package/dist/compliance/index.js +187 -103
  11. package/dist/compliance/index.js.map +1 -1
  12. package/dist/compliance/index.mjs +187 -104
  13. package/dist/compliance/index.mjs.map +1 -1
  14. package/dist/decisions/index.d.mts +2 -2
  15. package/dist/decisions/index.d.ts +2 -2
  16. package/dist/decisions/index.js +1 -1
  17. package/dist/decisions/index.js.map +1 -1
  18. package/dist/decisions/index.mjs +1 -1
  19. package/dist/decisions/index.mjs.map +1 -1
  20. package/dist/geolocation/index.d.mts +4 -4
  21. package/dist/geolocation/index.d.ts +4 -4
  22. package/dist/geolocation/index.js +7 -24
  23. package/dist/geolocation/index.js.map +1 -1
  24. package/dist/geolocation/index.mjs +7 -24
  25. package/dist/geolocation/index.mjs.map +1 -1
  26. package/dist/index.d.mts +12 -70
  27. package/dist/index.d.ts +12 -70
  28. package/dist/index.js +294 -292
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +293 -291
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/kyc/core.d.mts +4 -4
  33. package/dist/kyc/core.d.ts +4 -4
  34. package/dist/kyc/core.js +78 -23
  35. package/dist/kyc/core.js.map +1 -1
  36. package/dist/kyc/core.mjs +78 -24
  37. package/dist/kyc/core.mjs.map +1 -1
  38. package/dist/kyc/index.d.mts +269 -45
  39. package/dist/kyc/index.d.ts +269 -45
  40. package/dist/kyc/index.js +78 -23
  41. package/dist/kyc/index.js.map +1 -1
  42. package/dist/kyc/index.mjs +78 -24
  43. package/dist/kyc/index.mjs.map +1 -1
  44. package/dist/react.d.mts +42 -7
  45. package/dist/react.d.ts +42 -7
  46. package/dist/react.js +663 -277
  47. package/dist/react.js.map +1 -1
  48. package/dist/react.mjs +663 -277
  49. package/dist/react.mjs.map +1 -1
  50. package/dist/risk-profile/index.d.mts +4 -4
  51. package/dist/risk-profile/index.d.ts +4 -4
  52. package/dist/risk-profile/index.js +1 -1
  53. package/dist/risk-profile/index.js.map +1 -1
  54. package/dist/risk-profile/index.mjs +1 -1
  55. package/dist/risk-profile/index.mjs.map +1 -1
  56. package/dist/scores/index.d.mts +2 -2
  57. package/dist/scores/index.d.ts +2 -2
  58. package/dist/scores/index.js +1 -1
  59. package/dist/scores/index.js.map +1 -1
  60. package/dist/scores/index.mjs +1 -1
  61. package/dist/scores/index.mjs.map +1 -1
  62. package/dist/tax/index.d.mts +6 -41
  63. package/dist/tax/index.d.ts +6 -41
  64. package/dist/tax/index.js +1 -36
  65. package/dist/tax/index.js.map +1 -1
  66. package/dist/tax/index.mjs +1 -36
  67. package/dist/tax/index.mjs.map +1 -1
  68. package/dist/{types-1RzYeSal.d.mts → types-BOFaMQxI.d.mts} +2 -2
  69. package/dist/{types-B4Ezqo7V.d.mts → types-CBQRNL-l.d.mts} +14 -1
  70. package/dist/{types-B4Ezqo7V.d.ts → types-CBQRNL-l.d.ts} +14 -1
  71. package/dist/{types-X5Md_dD_.d.ts → types-UGyDl1fd.d.ts} +2 -2
  72. package/dist/webhooks/index.d.mts +189 -2
  73. package/dist/webhooks/index.d.ts +189 -2
  74. package/dist/webhooks/index.js +49 -7
  75. package/dist/webhooks/index.js.map +1 -1
  76. package/dist/webhooks/index.mjs +49 -7
  77. package/dist/webhooks/index.mjs.map +1 -1
  78. package/package.json +16 -13
  79. package/dist/fraud/index.d.mts +0 -80
  80. package/dist/fraud/index.d.ts +0 -80
  81. package/dist/fraud/index.js +0 -606
  82. package/dist/fraud/index.js.map +0 -1
  83. package/dist/fraud/index.mjs +0 -604
  84. package/dist/fraud/index.mjs.map +0 -1
  85. package/dist/index-B04H4xfJ.d.mts +0 -320
  86. package/dist/index-CItMPmLL.d.ts +0 -320
@@ -0,0 +1,436 @@
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-DMIRx7Tu.mjs';
2
+ import { RiskProfileClient } from './risk-profile/index.mjs';
3
+ import { V as VesantConfig, R as RequestOptions } from './client-BolQlL5e.mjs';
4
+ import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
5
+ import { E as EntityType, B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.mjs';
6
+
7
+ interface RegistrationVerificationRequest {
8
+ customerId: string;
9
+ fullName: string;
10
+ emailAddress: string;
11
+ phoneNumber?: string;
12
+ dateOfBirth?: string;
13
+ address?: string;
14
+ entityType?: EntityType;
15
+ ipAddress: string;
16
+ deviceFingerprint?: DeviceFingerprintRequest;
17
+ cipherText?: string;
18
+ metadata?: Record<string, unknown>;
19
+ }
20
+ interface RegistrationVerificationResponse {
21
+ allowed: boolean;
22
+ geolocation: LocationVerification;
23
+ profile: CustomerProfile | null;
24
+ requiresKYC: boolean;
25
+ requiresEDD: boolean;
26
+ blockReasons: string[];
27
+ blockReasonsStructured?: BlockReason[];
28
+ processingTime: number;
29
+ cipherTextValidation?: ValidateCipherTextResponse;
30
+ }
31
+ interface LoginVerificationRequest {
32
+ customerId: string;
33
+ ipAddress: string;
34
+ deviceFingerprint?: DeviceFingerprintRequest;
35
+ cipherText?: string;
36
+ metadata?: Record<string, unknown>;
37
+ }
38
+ interface LoginVerificationResponse {
39
+ allowed: boolean;
40
+ geolocation: LocationVerification;
41
+ profile: CustomerProfile | null;
42
+ requiresStepUp: boolean;
43
+ blockReasons: string[];
44
+ blockReasonsStructured?: BlockReason[];
45
+ processingTime: number;
46
+ cipherTextValidation?: ValidateCipherTextResponse;
47
+ }
48
+ interface TransactionVerificationRequest {
49
+ customerId: string;
50
+ ipAddress: string;
51
+ amount: number;
52
+ currency: string;
53
+ transactionType?: 'deposit' | 'withdrawal' | 'bet' | 'transfer' | 'payout';
54
+ deviceFingerprint?: DeviceFingerprintRequest;
55
+ cipherText?: string;
56
+ metadata?: Record<string, unknown>;
57
+ }
58
+ interface TransactionVerificationResponse {
59
+ allowed: boolean;
60
+ geolocation: LocationVerification;
61
+ profile: CustomerProfile | null;
62
+ transactionRisk: TransactionRiskResult;
63
+ requiresApproval: boolean;
64
+ blockReasons: string[];
65
+ blockReasonsStructured?: BlockReason[];
66
+ processingTime: number;
67
+ cipherTextValidation?: ValidateCipherTextResponse;
68
+ }
69
+ interface TransactionRiskResult {
70
+ score: number;
71
+ level: 'low' | 'medium' | 'high' | 'critical';
72
+ factors: string[];
73
+ factorsStructured?: BlockReason[];
74
+ allowed: boolean;
75
+ requiresManualReview: boolean;
76
+ }
77
+ interface EventVerificationRequest {
78
+ customerId: string;
79
+ ipAddress: string;
80
+ eventType: string;
81
+ deviceFingerprint?: DeviceFingerprintRequest;
82
+ cipherText?: string;
83
+ metadata?: Record<string, unknown>;
84
+ }
85
+ interface EventVerificationResponse {
86
+ allowed: boolean;
87
+ geolocation: LocationVerification;
88
+ blockReasons: string[];
89
+ blockReasonsStructured?: BlockReason[];
90
+ processingTime: number;
91
+ cipherTextValidation?: ValidateCipherTextResponse;
92
+ }
93
+ interface CurrencyRates {
94
+ [currency: string]: number;
95
+ }
96
+ declare const DEFAULT_CURRENCY_RATES: CurrencyRates;
97
+
98
+ interface ComplianceLocationRequestInput {
99
+ /** Customer user ID to request location from */
100
+ customerId: string;
101
+ /** Notification channel to use */
102
+ channel: 'sms' | 'email' | 'push';
103
+ /** Reason for requesting location (for compliance/audit) */
104
+ reason: string;
105
+ /** Customer email (required for email channel) */
106
+ email?: string;
107
+ /** Customer phone (required for SMS channel) */
108
+ phone?: string;
109
+ /** Custom expiry time in hours (default: 24) */
110
+ expiryHours?: number;
111
+ }
112
+ interface ComplianceLocationRequestResult {
113
+ /** The created location request */
114
+ request: LocationRequest;
115
+ /** Shareable link for the customer */
116
+ shareLink: string;
117
+ /** Token expiration time */
118
+ tokenExpiry: string;
119
+ /** Customer profile (if available) */
120
+ profile?: CustomerProfile;
121
+ }
122
+
123
+ /**
124
+ * ComplianceClient - Unified Compliance Orchestration
125
+ *
126
+ * Main integration point for casino platforms. Orchestrates geolocation
127
+ * verification with customer risk profiling for complete compliance coverage.
128
+ *
129
+ * SDK is the primary data injection point for compliance verification.
130
+ */
131
+
132
+ declare class ComplianceClient {
133
+ private geoClient;
134
+ private riskClient;
135
+ private config;
136
+ private logger;
137
+ private currencyRates;
138
+ private _currencyRatesCustomized;
139
+ private _currencyRatesWarned;
140
+ constructor(config: VesantConfig);
141
+ /** Get the underlying GeolocationClient for direct geolocation API access */
142
+ getGeolocationClient(): GeolocationClient;
143
+ /** Get the underlying RiskProfileClient for direct risk profile API access */
144
+ getRiskProfileClient(): RiskProfileClient;
145
+ /**
146
+ * Verify customer registration with automatic profile creation
147
+ *
148
+ * This is the primary integration point for new customer sign-ups.
149
+ * Combines geolocation verification with customer risk profile creation.
150
+ *
151
+ * Important: Profile is only created if geolocation verification passes.
152
+ * This prevents orphaned geolocation records when registration is blocked.
153
+ *
154
+ * @param request - Registration verification request
155
+ * @returns Verification response with profile and compliance status
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * const result = await sdk.verifyAtRegistration({
160
+ * customerId: 'CUST-12345',
161
+ * fullName: 'John Doe',
162
+ * emailAddress: 'john@example.com',
163
+ * ipAddress: req.ip,
164
+ * deviceFingerprint: getDeviceFingerprint()
165
+ * });
166
+ *
167
+ * if (result.allowed) {
168
+ * // Create account
169
+ * console.log('Profile created:', result.profile);
170
+ * if (result.requiresKYC) {
171
+ * // Redirect to KYC flow
172
+ * }
173
+ * } else {
174
+ * // Block registration
175
+ * console.log('Blocked:', result.blockReasons);
176
+ * }
177
+ * ```
178
+ */
179
+ verifyAtRegistration(request: RegistrationVerificationRequest, requestOptions?: RequestOptions): Promise<RegistrationVerificationResponse>;
180
+ /**
181
+ * Evaluate if registration should be blocked based on geolocation verification
182
+ *
183
+ * Checks:
184
+ * 1. General compliance status (is_compliant)
185
+ * 2. Explicit block flag (is_blocked)
186
+ * 3. Jurisdiction-specific registration allowance (allow_registration)
187
+ * 4. Risk level thresholds
188
+ *
189
+ * @param geoVerification - Geolocation verification result
190
+ * @returns Array of block reasons (empty if allowed)
191
+ */
192
+ private evaluateRegistrationBlock;
193
+ /**
194
+ * Validate registration request has all required fields
195
+ *
196
+ * @param request - Registration request to validate
197
+ * @throws ValidationError if required fields are missing or invalid
198
+ */
199
+ private validateRegistrationRequest;
200
+ /**
201
+ * Validate IP address format (IPv4 or IPv6)
202
+ */
203
+ private isValidIP;
204
+ /**
205
+ * Validate email address format
206
+ */
207
+ private isValidEmail;
208
+ private validateLoginRequest;
209
+ private validateTransactionRequest;
210
+ private validateEventRequest;
211
+ /**
212
+ * Verify customer login with profile activity update
213
+ *
214
+ * Verifies geolocation and updates customer profile with latest activity.
215
+ *
216
+ * @param request - Login verification request
217
+ * @returns Verification response with compliance status
218
+ *
219
+ * @example
220
+ * ```typescript
221
+ * const result = await sdk.verifyAtLogin({
222
+ * customerId: 'CUST-12345',
223
+ * ipAddress: req.ip,
224
+ * deviceFingerprint: getDeviceFingerprint()
225
+ * });
226
+ *
227
+ * if (result.allowed) {
228
+ * // Allow login
229
+ * if (result.requiresStepUp) {
230
+ * // Trigger MFA or additional verification
231
+ * }
232
+ * } else {
233
+ * // Block login
234
+ * console.log('Blocked:', result.blockReasons);
235
+ * }
236
+ * ```
237
+ */
238
+ verifyAtLogin(request: LoginVerificationRequest, requestOptions?: RequestOptions): Promise<LoginVerificationResponse>;
239
+ /**
240
+ * Verify transaction with amount-based risk assessment
241
+ *
242
+ * Combines geolocation verification with transaction amount analysis
243
+ * and customer risk profile for comprehensive transaction screening.
244
+ *
245
+ * @param request - Transaction verification request
246
+ * @returns Verification response with transaction risk assessment
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * const result = await sdk.verifyAtTransaction({
251
+ * customerId: 'CUST-12345',
252
+ * ipAddress: req.ip,
253
+ * amount: 5000,
254
+ * currency: 'USD',
255
+ * transactionType: 'withdrawal',
256
+ * deviceFingerprint: getDeviceFingerprint()
257
+ * });
258
+ *
259
+ * if (result.allowed) {
260
+ * // Process transaction
261
+ * } else if (result.requiresApproval) {
262
+ * // Queue for manual review
263
+ * } else {
264
+ * // Block transaction
265
+ * console.log('Blocked:', result.blockReasons);
266
+ * }
267
+ * ```
268
+ */
269
+ verifyAtTransaction(request: TransactionVerificationRequest, requestOptions?: RequestOptions): Promise<TransactionVerificationResponse>;
270
+ /**
271
+ * Generic event verification (for other touchpoints)
272
+ *
273
+ * @param request - Event verification request
274
+ * @returns Verification response
275
+ */
276
+ verifyEvent(request: EventVerificationRequest, requestOptions?: RequestOptions): Promise<EventVerificationResponse>;
277
+ private buildReasonTail;
278
+ private shouldUpdateProfile;
279
+ private createProfileFromGeo;
280
+ /**
281
+ * Execute cipherText validation with graceful degradation.
282
+ * Returns undefined if cipherText is not provided or validation fails.
283
+ */
284
+ private executeCipherTextValidation;
285
+ /**
286
+ * Build a LocationVerification from a ValidateCipherTextResponse.
287
+ * The validate-ciphertext endpoint now returns the full geo-verification data
288
+ * (is_compliant, jurisdiction, geofence_evaluation, record_id, gps_required),
289
+ * so a separate verifyIP call is unnecessary.
290
+ */
291
+ private buildLocationFromCipherText;
292
+ private calculateTransactionRisk;
293
+ private checkJurisdictionLimits;
294
+ private normalizeToUSD;
295
+ private getRiskLevel;
296
+ private getBlockReasons;
297
+ private getTransactionBlockReasons;
298
+ /**
299
+ * Request live location from a customer
300
+ *
301
+ * Creates a location request and sends a notification to the customer
302
+ * via the specified channel (SMS, email, or push). The customer receives
303
+ * a link to share their location.
304
+ *
305
+ * @param input - Location request details
306
+ * @returns Location request result with share link
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * // Request location via SMS for transaction verification
311
+ * const result = await sdk.requestCustomerLocation({
312
+ * customerId: 'CUST-12345',
313
+ * channel: 'sms',
314
+ * phone: '+1234567890',
315
+ * reason: 'Verification required for high-value transaction'
316
+ * });
317
+ *
318
+ * console.log('Share link sent:', result.shareLink);
319
+ * console.log('Expires at:', result.tokenExpiry);
320
+ *
321
+ * // Request location via email
322
+ * const emailResult = await sdk.requestCustomerLocation({
323
+ * customerId: 'CUST-12345',
324
+ * channel: 'email',
325
+ * email: 'customer@example.com',
326
+ * reason: 'Account verification',
327
+ * expiryHours: 48
328
+ * });
329
+ * ```
330
+ */
331
+ requestCustomerLocation(input: ComplianceLocationRequestInput, requestOptions?: RequestOptions): Promise<ComplianceLocationRequestResult>;
332
+ /**
333
+ * Get a specific location request by ID
334
+ *
335
+ * @param requestId - Location request ID
336
+ * @returns Location request details
337
+ *
338
+ * @example
339
+ * ```typescript
340
+ * const request = await sdk.getLocationRequest('req_abc123');
341
+ * console.log('Status:', request.status);
342
+ * if (request.latitude && request.longitude) {
343
+ * console.log('Location captured:', request.latitude, request.longitude);
344
+ * }
345
+ * ```
346
+ */
347
+ getLocationRequest(requestId: string, requestOptions?: RequestOptions): Promise<LocationRequest>;
348
+ /**
349
+ * List location requests with filters and pagination
350
+ *
351
+ * @param filters - Optional filters
352
+ * @param pagination - Optional pagination
353
+ * @returns Paginated list of location requests
354
+ *
355
+ * @example
356
+ * ```typescript
357
+ * // Get pending requests for a customer
358
+ * const pending = await sdk.listLocationRequests(
359
+ * { status: 'pending', user_id: 'CUST-12345' },
360
+ * { page: 1, limit: 20 }
361
+ * );
362
+ *
363
+ * // Get all completed requests from last week
364
+ * const completed = await sdk.listLocationRequests({
365
+ * status: 'completed',
366
+ * date_from: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString()
367
+ * });
368
+ * ```
369
+ */
370
+ listLocationRequests(filters?: LocationRequestFilters, pagination?: PaginationParams, requestOptions?: RequestOptions): Promise<LocationRequestListResponse>;
371
+ /**
372
+ * Cancel a pending location request
373
+ *
374
+ * @param requestId - Location request ID
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * await sdk.cancelLocationRequest('req_abc123');
379
+ * ```
380
+ */
381
+ cancelLocationRequest(requestId: string, requestOptions?: RequestOptions): Promise<void>;
382
+ /**
383
+ * Resend notification for a location request
384
+ *
385
+ * @param requestId - Location request ID
386
+ * @param contact - Contact details (email or phone)
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * // Resend to a different phone number
391
+ * await sdk.resendLocationRequest('req_abc123', { phone: '+0987654321' });
392
+ *
393
+ * // Resend to email
394
+ * await sdk.resendLocationRequest('req_abc123', { email: 'new@example.com' });
395
+ * ```
396
+ */
397
+ resendLocationRequest(requestId: string, contact: {
398
+ email?: string;
399
+ phone?: string;
400
+ }, requestOptions?: RequestOptions): Promise<void>;
401
+ /**
402
+ * Validate location request input
403
+ */
404
+ private validateLocationRequestInput;
405
+ /**
406
+ * Update currency exchange rates
407
+ *
408
+ * Use this to keep currency rates current for accurate transaction risk
409
+ * calculation. Rates should be updated regularly (e.g., daily).
410
+ *
411
+ * @param rates - Currency to USD exchange rates
412
+ *
413
+ * @example
414
+ * ```typescript
415
+ * // Update specific rates
416
+ * sdk.updateCurrencyRates({
417
+ * EUR: 1.08,
418
+ * GBP: 1.25,
419
+ * BTC: 42000, // For crypto support
420
+ * });
421
+ *
422
+ * // Or fetch from external service
423
+ * const rates = await fetchExchangeRates();
424
+ * sdk.updateCurrencyRates(rates);
425
+ * ```
426
+ */
427
+ updateCurrencyRates(rates: CurrencyRates): void;
428
+ /**
429
+ * Get current currency rates
430
+ *
431
+ * @returns Current currency to USD exchange rates
432
+ */
433
+ getCurrencyRates(): Readonly<CurrencyRates>;
434
+ }
435
+
436
+ export { ComplianceClient as C, DEFAULT_CURRENCY_RATES as D, type EventVerificationRequest as E, type LoginVerificationRequest as L, type RegistrationVerificationRequest as R, type TransactionRiskResult as T, type ComplianceLocationRequestInput as a, type ComplianceLocationRequestResult as b, type CurrencyRates as c, type EventVerificationResponse as d, type LoginVerificationResponse as e, type RegistrationVerificationResponse as f, type TransactionVerificationRequest as g, type TransactionVerificationResponse as h };