vesant-sdk 1.6.6 → 2.0.0-dev.40d1c39

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