vesant-sdk 1.0.4

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 (50) hide show
  1. package/README.md +247 -0
  2. package/dist/client-CA9Wr_qb.d.ts +1108 -0
  3. package/dist/client-DMNkESa0.d.mts +1108 -0
  4. package/dist/compliance/index.d.mts +543 -0
  5. package/dist/compliance/index.d.ts +543 -0
  6. package/dist/compliance/index.js +2133 -0
  7. package/dist/compliance/index.js.map +1 -0
  8. package/dist/compliance/index.mjs +2130 -0
  9. package/dist/compliance/index.mjs.map +1 -0
  10. package/dist/geolocation/index.d.mts +73 -0
  11. package/dist/geolocation/index.d.ts +73 -0
  12. package/dist/geolocation/index.js +1100 -0
  13. package/dist/geolocation/index.js.map +1 -0
  14. package/dist/geolocation/index.mjs +1094 -0
  15. package/dist/geolocation/index.mjs.map +1 -0
  16. package/dist/index.d.mts +50 -0
  17. package/dist/index.d.ts +50 -0
  18. package/dist/index.js +2968 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/index.mjs +2948 -0
  21. package/dist/index.mjs.map +1 -0
  22. package/dist/kyc/core.d.mts +3 -0
  23. package/dist/kyc/core.d.ts +3 -0
  24. package/dist/kyc/core.js +773 -0
  25. package/dist/kyc/core.js.map +1 -0
  26. package/dist/kyc/core.mjs +771 -0
  27. package/dist/kyc/core.mjs.map +1 -0
  28. package/dist/kyc/index.d.mts +734 -0
  29. package/dist/kyc/index.d.ts +734 -0
  30. package/dist/kyc/index.js +773 -0
  31. package/dist/kyc/index.js.map +1 -0
  32. package/dist/kyc/index.mjs +771 -0
  33. package/dist/kyc/index.mjs.map +1 -0
  34. package/dist/react.d.mts +487 -0
  35. package/dist/react.d.ts +487 -0
  36. package/dist/react.js +1122 -0
  37. package/dist/react.js.map +1 -0
  38. package/dist/react.mjs +1102 -0
  39. package/dist/react.mjs.map +1 -0
  40. package/dist/risk-profile/index.d.mts +228 -0
  41. package/dist/risk-profile/index.d.ts +228 -0
  42. package/dist/risk-profile/index.js +548 -0
  43. package/dist/risk-profile/index.js.map +1 -0
  44. package/dist/risk-profile/index.mjs +546 -0
  45. package/dist/risk-profile/index.mjs.map +1 -0
  46. package/dist/types-Bnsnejor.d.mts +150 -0
  47. package/dist/types-Bnsnejor.d.ts +150 -0
  48. package/dist/types-CFupjwi8.d.ts +213 -0
  49. package/dist/types-CqOLbaXk.d.mts +213 -0
  50. package/package.json +94 -0
@@ -0,0 +1,1108 @@
1
+ import { P as PaginationParams, B as BaseClient } from './types-Bnsnejor.mjs';
2
+
3
+ /**
4
+ * TypeScript type definitions for CGS Geolocation Service API
5
+ *
6
+ * These types match the Go API structures in:
7
+ * - services/geolocation-service/internal/domain/
8
+ * - services/geolocation-service/internal/service/
9
+ * - services/geolocation-service/internal/handler/
10
+ */
11
+
12
+ interface DeviceFingerprintRequest {
13
+ device_id: string;
14
+ user_agent: string;
15
+ platform: string;
16
+ browser?: string;
17
+ browser_version?: string;
18
+ os?: string;
19
+ os_version?: string;
20
+ screen_resolution?: string;
21
+ language?: string;
22
+ timezone?: string;
23
+ }
24
+ /**
25
+ * Raw device and location data collected from the client
26
+ * This data is encrypted into a cipherText before being sent to the server
27
+ */
28
+ interface CipherTextPayload {
29
+ /** Device fingerprint data */
30
+ device: {
31
+ device_id: string;
32
+ user_agent: string;
33
+ platform: string;
34
+ browser?: string;
35
+ browser_version?: string;
36
+ os?: string;
37
+ os_version?: string;
38
+ screen_resolution?: string;
39
+ language?: string;
40
+ timezone?: string;
41
+ color_depth?: number;
42
+ hardware_concurrency?: number;
43
+ device_memory?: number;
44
+ touch_support?: boolean;
45
+ webgl_vendor?: string;
46
+ webgl_renderer?: string;
47
+ };
48
+ /** GPS/Geolocation data (if available) */
49
+ location?: {
50
+ latitude: number;
51
+ longitude: number;
52
+ accuracy: number;
53
+ altitude?: number;
54
+ altitude_accuracy?: number;
55
+ heading?: number;
56
+ speed?: number;
57
+ timestamp: number;
58
+ };
59
+ /** Network information */
60
+ network?: {
61
+ effective_type?: string;
62
+ downlink?: number;
63
+ rtt?: number;
64
+ save_data?: boolean;
65
+ };
66
+ /** Collection metadata */
67
+ metadata: {
68
+ collected_at: string;
69
+ sdk_version: string;
70
+ collection_reason: CipherTextReason;
71
+ page_url?: string;
72
+ referrer?: string;
73
+ };
74
+ }
75
+ /**
76
+ * Reason for collecting the cipherText
77
+ */
78
+ type CipherTextReason = 'registration' | 'login' | 'transaction' | 'interval_check' | 'ip_change' | 'game_launch' | 'withdrawal' | 'manual_verification';
79
+ /**
80
+ * Options for generating cipherText
81
+ */
82
+ interface CipherTextOptions {
83
+ /** Reason for collection (required) */
84
+ reason: CipherTextReason;
85
+ /** Request GPS location (default: false) */
86
+ requestLocation?: boolean;
87
+ /** GPS timeout in milliseconds (default: 10000) */
88
+ locationTimeout?: number;
89
+ /** High accuracy GPS (default: true) */
90
+ highAccuracy?: boolean;
91
+ /** Include network info (default: true) */
92
+ includeNetworkInfo?: boolean;
93
+ /** Include WebGL info for fingerprinting (default: true) */
94
+ includeWebGL?: boolean;
95
+ /** Custom user ID to include */
96
+ userId?: string;
97
+ }
98
+ /**
99
+ * Result from cipherText generation
100
+ */
101
+ interface CipherTextResult {
102
+ /** The encrypted cipherText string */
103
+ cipherText: string;
104
+ /** Whether GPS location was successfully captured */
105
+ locationCaptured: boolean;
106
+ /** Any errors that occurred during collection (non-fatal) */
107
+ warnings?: string[];
108
+ /** Timestamp when cipherText was generated */
109
+ generatedAt: string;
110
+ /** Expiry time for the cipherText */
111
+ expiresAt: string;
112
+ }
113
+ /**
114
+ * Decrypted cipherText data (returned by server after validation)
115
+ */
116
+ interface DecryptedCipherText {
117
+ /** Whether the cipherText is valid */
118
+ valid: boolean;
119
+ /** Validation errors if any */
120
+ errors?: string[];
121
+ /** The decrypted payload */
122
+ payload?: CipherTextPayload;
123
+ /** Extracted device UUID */
124
+ device_uuid?: string;
125
+ /** Extracted IP address (from server) */
126
+ ip_address?: string;
127
+ /** Risk assessment */
128
+ risk?: {
129
+ score: number;
130
+ level: 'low' | 'medium' | 'high' | 'critical';
131
+ factors: string[];
132
+ };
133
+ }
134
+ /**
135
+ * Request to validate cipherText on the server
136
+ */
137
+ interface ValidateCipherTextRequest {
138
+ cipher_text: string;
139
+ user_id: string;
140
+ event_type: CipherTextReason;
141
+ expected_ip?: string;
142
+ }
143
+ /**
144
+ * Response from cipherText validation
145
+ */
146
+ interface ValidateCipherTextResponse {
147
+ valid: boolean;
148
+ device_uuid: string;
149
+ ip_address: string;
150
+ location?: {
151
+ latitude: number;
152
+ longitude: number;
153
+ accuracy: number;
154
+ country?: string;
155
+ country_iso?: string;
156
+ city?: string;
157
+ region?: string;
158
+ };
159
+ device: {
160
+ platform: string;
161
+ browser?: string;
162
+ os?: string;
163
+ is_mobile: boolean;
164
+ is_tablet: boolean;
165
+ };
166
+ risk: {
167
+ score: number;
168
+ level: 'low' | 'medium' | 'high' | 'critical';
169
+ factors: string[];
170
+ is_vpn: boolean;
171
+ is_proxy: boolean;
172
+ is_tor: boolean;
173
+ };
174
+ errors?: string[];
175
+ }
176
+ interface VerifyIPRequest {
177
+ ip_address: string;
178
+ user_id: string;
179
+ event_type: string;
180
+ device_fingerprint?: DeviceFingerprintRequest;
181
+ }
182
+ interface GeoIPResult {
183
+ country: string;
184
+ country_iso: string;
185
+ city: string;
186
+ region: string;
187
+ postal_code: string;
188
+ latitude: number;
189
+ longitude: number;
190
+ timezone: string;
191
+ is_vpn: boolean;
192
+ is_proxy: boolean;
193
+ is_tor: boolean;
194
+ is_hosting: boolean;
195
+ is_anonymizer: boolean;
196
+ }
197
+ interface JurisdictionConfig {
198
+ id: string;
199
+ tenant_id: string;
200
+ country_iso: string;
201
+ country_name: string;
202
+ status: 'allowed' | 'restricted' | 'blocked' | 'sanctioned';
203
+ risk_level: 'low' | 'medium' | 'high';
204
+ allow_login: boolean;
205
+ allow_registration: boolean;
206
+ allow_transactions: boolean;
207
+ max_transaction_amount?: number;
208
+ require_kyc: boolean;
209
+ require_enhanced_verification: boolean;
210
+ compliance_notes?: string;
211
+ created_at: string;
212
+ updated_at: string;
213
+ }
214
+ interface GeofenceEvaluation {
215
+ matched_rules: string[];
216
+ blocked: boolean;
217
+ should_alert: boolean;
218
+ reasons: string[];
219
+ }
220
+ interface DeviceFingerprint {
221
+ id: string;
222
+ tenant_id: string;
223
+ user_id: string;
224
+ device_id: string;
225
+ user_agent: string;
226
+ platform: string;
227
+ browser?: string;
228
+ browser_version?: string;
229
+ os?: string;
230
+ os_version?: string;
231
+ screen_resolution?: string;
232
+ language?: string;
233
+ timezone?: string;
234
+ ip_address?: string;
235
+ last_ip_address?: string;
236
+ last_location?: string;
237
+ is_trusted: boolean;
238
+ trust_score: number;
239
+ risk_flags?: string;
240
+ first_seen_at: string;
241
+ last_seen_at: string;
242
+ login_count: number;
243
+ location_changes: number;
244
+ }
245
+ interface DeviceTrustResult {
246
+ device: DeviceFingerprint;
247
+ is_new_device: boolean;
248
+ is_trusted: boolean;
249
+ trust_score: number;
250
+ risk_factors: string[];
251
+ recommendations: string[];
252
+ }
253
+ interface LocationVerification {
254
+ ip_address: string;
255
+ location: GeoIPResult;
256
+ is_compliant: boolean;
257
+ is_blocked: boolean;
258
+ risk_level: 'low' | 'medium' | 'high' | 'critical';
259
+ risk_score: number;
260
+ risk_reasons: string[];
261
+ jurisdiction?: JurisdictionConfig;
262
+ geofence_evaluation?: GeofenceEvaluation;
263
+ device_trust?: DeviceTrustResult;
264
+ record_id: string;
265
+ }
266
+ interface ComplianceCheckResponse {
267
+ jurisdiction?: JurisdictionConfig;
268
+ is_compliant: boolean;
269
+ message: string;
270
+ }
271
+ type AlertStatus = 'active' | 'under_review' | 'resolved' | 'false_positive' | 'blocked';
272
+ type AlertSeverity = 'low' | 'medium' | 'high' | 'critical';
273
+ type AlertType = 'high_risk_login' | 'sanctioned_region' | 'geofence_violation' | 'tor_detected' | 'vpn_detected' | 'proxy_detected' | 'anonymization_detected' | 'anonymization_tool_detected' | 'high_risk_country' | 'impossible_travel' | 'device_fingerprint_mismatch';
274
+ interface GeolocationAlert {
275
+ id: string;
276
+ tenant_id: string;
277
+ user_id: string;
278
+ alert_type: AlertType;
279
+ severity: AlertSeverity;
280
+ status: AlertStatus;
281
+ ip_address?: string;
282
+ location?: string;
283
+ risk_score?: number;
284
+ risk_factors?: string;
285
+ geolocation_record_id?: string;
286
+ assigned_to?: string;
287
+ resolution?: string;
288
+ notes?: string;
289
+ resolved_by?: string;
290
+ resolved_at?: string;
291
+ created_at: string;
292
+ updated_at: string;
293
+ }
294
+ interface AlertFilters {
295
+ status?: AlertStatus;
296
+ severity?: AlertSeverity;
297
+ alert_type?: AlertType;
298
+ user_id?: string;
299
+ assigned_to?: string;
300
+ start_date?: string;
301
+ end_date?: string;
302
+ }
303
+ interface AlertListResponse {
304
+ alerts: GeolocationAlert[];
305
+ total: number;
306
+ page: number;
307
+ page_size: number;
308
+ }
309
+ interface DashboardMetrics {
310
+ total_alerts: number;
311
+ active_alerts: number;
312
+ critical_alerts: number;
313
+ high_alerts: number;
314
+ alerts_by_status: Record<AlertStatus, number>;
315
+ alerts_by_severity: Record<AlertSeverity, number>;
316
+ alerts_by_type: Record<string, number>;
317
+ top_risk_users: Array<{
318
+ user_id: string;
319
+ alert_count: number;
320
+ max_risk_score: number;
321
+ }>;
322
+ top_risk_countries: Array<{
323
+ country: string;
324
+ alert_count: number;
325
+ }>;
326
+ }
327
+ interface CreateJurisdictionRequest {
328
+ country_iso: string;
329
+ country_name: string;
330
+ status: 'allowed' | 'restricted' | 'blocked' | 'sanctioned';
331
+ risk_level: 'low' | 'medium' | 'high';
332
+ allow_login: boolean;
333
+ allow_registration: boolean;
334
+ allow_transactions: boolean;
335
+ max_transaction_amount?: number;
336
+ require_kyc: boolean;
337
+ require_enhanced_verification: boolean;
338
+ compliance_notes?: string;
339
+ }
340
+ interface UpdateJurisdictionRequest extends Partial<CreateJurisdictionRequest> {
341
+ }
342
+ type GeofenceRuleType = 'block_list' | 'allow_list' | 'risk_threshold';
343
+ type GeofenceAction = 'block' | 'alert' | 'allow_with_warning';
344
+ interface GeofenceRule {
345
+ id: string;
346
+ tenant_id: string;
347
+ name: string;
348
+ description?: string;
349
+ rule_type: GeofenceRuleType;
350
+ action: GeofenceAction;
351
+ priority: number;
352
+ countries?: string;
353
+ cities?: string;
354
+ latitude?: number;
355
+ longitude?: number;
356
+ radius_km?: number;
357
+ risk_threshold?: number;
358
+ event_types?: string;
359
+ is_active: boolean;
360
+ created_by: string;
361
+ created_at: string;
362
+ updated_at: string;
363
+ }
364
+ interface CreateGeofenceRuleRequest {
365
+ name: string;
366
+ description?: string;
367
+ rule_type: GeofenceRuleType;
368
+ action: GeofenceAction;
369
+ priority?: number;
370
+ countries?: string[];
371
+ cities?: string[];
372
+ latitude?: number;
373
+ longitude?: number;
374
+ radius_km?: number;
375
+ risk_threshold?: number;
376
+ event_types?: string[];
377
+ is_active?: boolean;
378
+ }
379
+ interface UpdateGeofenceRuleRequest extends Partial<CreateGeofenceRuleRequest> {
380
+ }
381
+ interface UpdateDeviceTrustRequest {
382
+ device_id: string;
383
+ action: 'trust' | 'untrust';
384
+ }
385
+ interface GeolocationRecord {
386
+ id: string;
387
+ tenant_id: string;
388
+ user_id: string;
389
+ ip_address: string;
390
+ event_type: string;
391
+ country: string;
392
+ country_iso: string;
393
+ city: string;
394
+ region: string;
395
+ postal_code?: string;
396
+ latitude: number;
397
+ longitude: number;
398
+ timezone?: string;
399
+ is_vpn: boolean;
400
+ is_proxy: boolean;
401
+ is_tor: boolean;
402
+ is_hosting: boolean;
403
+ is_anonymizer: boolean;
404
+ risk_score: number;
405
+ risk_level: string;
406
+ provider: string;
407
+ provider_response?: string;
408
+ created_at: string;
409
+ }
410
+ interface APIError {
411
+ error: string;
412
+ message?: string;
413
+ details?: Record<string, unknown>;
414
+ }
415
+ interface GeolocationClientConfig {
416
+ /** Base URL of the API Gateway (e.g., "https://api.example.com") */
417
+ baseURL: string;
418
+ /** Tenant ID for multi-tenancy */
419
+ tenantId: string;
420
+ /** API key or JWT token for authentication */
421
+ apiKey?: string;
422
+ /** Custom headers to include in every request */
423
+ headers?: Record<string, string>;
424
+ /** Request timeout in milliseconds (default: 10000) */
425
+ timeout?: number;
426
+ /** Enable debug logging */
427
+ debug?: boolean;
428
+ }
429
+ interface UseGeolocationOptions {
430
+ /** Auto-detect and verify user's IP on mount */
431
+ autoVerify?: boolean;
432
+ /** Event type for verification */
433
+ eventType?: string;
434
+ /** Include device fingerprint in verification */
435
+ includeDeviceFingerprint?: boolean;
436
+ }
437
+ interface UseGeolocationResult {
438
+ /** Current verification result */
439
+ verification: LocationVerification | null;
440
+ /** Loading state */
441
+ loading: boolean;
442
+ /** Error state */
443
+ error: Error | null;
444
+ /** Verify an IP address */
445
+ verifyIP: (request: VerifyIPRequest) => Promise<LocationVerification>;
446
+ /** Check compliance for a country */
447
+ checkCompliance: (countryISO: string) => Promise<ComplianceCheckResponse>;
448
+ /** Refresh verification */
449
+ refresh: () => Promise<void>;
450
+ }
451
+ interface UseAlertsOptions {
452
+ /** Auto-fetch alerts on mount */
453
+ autoFetch?: boolean;
454
+ /** Initial filters */
455
+ filters?: AlertFilters;
456
+ /** Pagination settings */
457
+ pagination?: PaginationParams;
458
+ /** Poll interval in milliseconds (0 = no polling) */
459
+ pollInterval?: number;
460
+ }
461
+ interface UseAlertsResult {
462
+ /** List of alerts */
463
+ alerts: GeolocationAlert[];
464
+ /** Total count */
465
+ total: number;
466
+ /** Loading state */
467
+ loading: boolean;
468
+ /** Error state */
469
+ error: Error | null;
470
+ /** Fetch alerts with filters */
471
+ fetchAlerts: (filters?: AlertFilters, pagination?: PaginationParams) => Promise<void>;
472
+ /** Update alert status */
473
+ updateStatus: (alertId: string, status: AlertStatus) => Promise<void>;
474
+ /** Assign alert */
475
+ assignAlert: (alertId: string, assignedTo: string) => Promise<void>;
476
+ /** Resolve alert */
477
+ resolveAlert: (alertId: string, resolution: string, notes?: string) => Promise<void>;
478
+ /** Dismiss alert as false positive */
479
+ dismissAlert: (alertId: string, notes?: string) => Promise<void>;
480
+ /** Refresh alerts */
481
+ refresh: () => Promise<void>;
482
+ }
483
+ type LocationRequestStatus = 'pending' | 'sent' | 'completed' | 'expired' | 'cancelled' | 'failed';
484
+ type LocationRequestChannel = 'sms' | 'email' | 'push';
485
+ interface LocationRequest {
486
+ id: string;
487
+ tenant_id: string;
488
+ user_id: string;
489
+ requested_by: string;
490
+ channel: LocationRequestChannel;
491
+ status: LocationRequestStatus;
492
+ reason?: string;
493
+ token_expires_at: string;
494
+ latitude?: number;
495
+ longitude?: number;
496
+ accuracy?: number;
497
+ country?: string;
498
+ country_iso?: string;
499
+ city?: string;
500
+ region?: string;
501
+ formatted_address?: string;
502
+ position_source?: string;
503
+ notification_sent_at?: string;
504
+ responded_at?: string;
505
+ viewed_at?: string;
506
+ created_at: string;
507
+ updated_at: string;
508
+ }
509
+ interface CreateLocationRequestRequest {
510
+ /** Customer user ID to request location from */
511
+ user_id: string;
512
+ /** Notification channel to use */
513
+ channel: LocationRequestChannel;
514
+ /** Reason for requesting location (for compliance/audit) */
515
+ reason?: string;
516
+ /** Customer email (required for email channel) */
517
+ email?: string;
518
+ /** Customer phone (required for SMS channel) */
519
+ phone?: string;
520
+ /** Custom expiry time in hours (default: 24) */
521
+ expiry_hours?: number;
522
+ }
523
+ interface LocationRequestResult {
524
+ request: LocationRequest;
525
+ share_link: string;
526
+ token_expiry: string;
527
+ }
528
+ interface LocationRequestFilters {
529
+ status?: LocationRequestStatus;
530
+ user_id?: string;
531
+ requested_by?: string;
532
+ channel?: LocationRequestChannel;
533
+ date_from?: string;
534
+ date_to?: string;
535
+ }
536
+ interface LocationRequestListResponse {
537
+ requests: LocationRequest[];
538
+ total: number;
539
+ page: number;
540
+ limit: number;
541
+ total_pages: number;
542
+ }
543
+ interface ResendLocationRequestRequest {
544
+ email?: string;
545
+ phone?: string;
546
+ }
547
+ interface WiFiNetwork {
548
+ /** MAC address (BSSID) */
549
+ macAddress: string;
550
+ /** Signal strength in dBm (negative number) */
551
+ signalStrength?: number;
552
+ /** WiFi channel */
553
+ channel?: number;
554
+ /** Network name (optional) */
555
+ ssid?: string;
556
+ }
557
+ interface LocationCaptureRequest {
558
+ /** GPS latitude (if available) */
559
+ latitude?: number;
560
+ /** GPS longitude (if available) */
561
+ longitude?: number;
562
+ /** GPS accuracy in meters */
563
+ accuracy?: number;
564
+ /** WiFi networks for positioning (if GPS not available) */
565
+ wifi_networks?: WiFiNetwork[];
566
+ /** User agent string */
567
+ user_agent?: string;
568
+ /** Device metadata */
569
+ device_info?: {
570
+ platform?: string;
571
+ browser?: string;
572
+ browser_version?: string;
573
+ os?: string;
574
+ os_version?: string;
575
+ };
576
+ }
577
+ interface LocationShareInfo {
578
+ request_id: string;
579
+ tenant_id: string;
580
+ reason?: string;
581
+ expires_at: string;
582
+ status: string;
583
+ is_expired: boolean;
584
+ is_completed: boolean;
585
+ requires_wifi: boolean;
586
+ }
587
+ interface LocationCaptureResponse {
588
+ success: boolean;
589
+ status: string;
590
+ position_source?: string;
591
+ latitude?: number;
592
+ longitude?: number;
593
+ accuracy?: number;
594
+ }
595
+ interface UseLocationRequestsOptions {
596
+ /** Auto-fetch location requests on mount */
597
+ autoFetch?: boolean;
598
+ /** Initial filters */
599
+ filters?: LocationRequestFilters;
600
+ /** Pagination settings */
601
+ pagination?: PaginationParams;
602
+ /** Poll interval in milliseconds (0 = no polling) */
603
+ pollInterval?: number;
604
+ }
605
+ interface UseLocationRequestsResult {
606
+ /** List of location requests */
607
+ requests: LocationRequest[];
608
+ /** Total count */
609
+ total: number;
610
+ /** Current page */
611
+ page: number;
612
+ /** Total pages */
613
+ totalPages: number;
614
+ /** Loading state */
615
+ loading: boolean;
616
+ /** Error state */
617
+ error: Error | null;
618
+ /** Fetch location requests with filters */
619
+ fetchRequests: (filters?: LocationRequestFilters, pagination?: PaginationParams) => Promise<void>;
620
+ /** Create a new location request */
621
+ createRequest: (request: CreateLocationRequestRequest) => Promise<LocationRequestResult>;
622
+ /** Get a specific location request by ID */
623
+ getRequest: (requestId: string) => Promise<LocationRequest>;
624
+ /** Cancel a pending location request */
625
+ cancelRequest: (requestId: string) => Promise<void>;
626
+ /** Resend notification for a location request */
627
+ resendRequest: (requestId: string, contact: {
628
+ email?: string;
629
+ phone?: string;
630
+ }) => Promise<void>;
631
+ /** Refresh location requests */
632
+ refresh: () => Promise<void>;
633
+ }
634
+ interface UseLocationCaptureOptions {
635
+ /** Token from share link */
636
+ token: string;
637
+ /** Auto-fetch share info on mount */
638
+ autoFetch?: boolean;
639
+ /** Auto-request GPS permission on mount */
640
+ autoRequestGPS?: boolean;
641
+ /** Collect WiFi data as fallback (requires explicit permission) */
642
+ collectWiFi?: boolean;
643
+ }
644
+ interface UseLocationCaptureResult {
645
+ /** Location share info */
646
+ shareInfo: LocationShareInfo | null;
647
+ /** Capture response after submission */
648
+ captureResponse: LocationCaptureResponse | null;
649
+ /** Loading state */
650
+ loading: boolean;
651
+ /** Submitting state (during capture) */
652
+ submitting: boolean;
653
+ /** Error state */
654
+ error: Error | null;
655
+ /** Whether the request is expired */
656
+ isExpired: boolean;
657
+ /** Whether the request is already completed */
658
+ isCompleted: boolean;
659
+ /** Fetch share info */
660
+ fetchShareInfo: () => Promise<LocationShareInfo>;
661
+ /** Submit location capture */
662
+ submitLocation: (capture: LocationCaptureRequest) => Promise<LocationCaptureResponse>;
663
+ /** Request GPS and auto-submit location */
664
+ captureAndSubmitGPS: () => Promise<LocationCaptureResponse>;
665
+ }
666
+
667
+ /**
668
+ * GeolocationClient - TypeScript SDK for CGS Geolocation & Compliance Service
669
+ *
670
+ * Provides type-safe methods to interact with the geolocation service API.
671
+ * Extends BaseClient for consistent retry logic, timeout handling, and error management.
672
+ */
673
+
674
+ /**
675
+ * GeolocationClient extends BaseClient for:
676
+ * - Consistent retry logic with exponential backoff
677
+ * - Unified error handling (CGSError, NetworkError, TimeoutError, etc.)
678
+ * - Automatic timeout management
679
+ * - Debug logging
680
+ *
681
+ * All geolocation verification calls use requestWithRetry() to handle
682
+ * transient failures gracefully.
683
+ */
684
+ declare class GeolocationClient extends BaseClient {
685
+ constructor(config: GeolocationClientConfig);
686
+ /**
687
+ * Verify an IP address and check compliance
688
+ *
689
+ * Uses requestWithRetry() for automatic retry on transient failures.
690
+ *
691
+ * @param request - Verification request with IP, user ID, event type, and optional device fingerprint
692
+ * @returns Location verification result with risk assessment
693
+ *
694
+ * @example
695
+ * ```typescript
696
+ * const result = await client.verifyIP({
697
+ * ip_address: "8.8.8.8",
698
+ * user_id: "user_123",
699
+ * event_type: "login",
700
+ * device_fingerprint: {
701
+ * device_id: "device_abc",
702
+ * user_agent: navigator.userAgent,
703
+ * platform: "web"
704
+ * }
705
+ * });
706
+ *
707
+ * if (result.is_blocked) {
708
+ * console.log("Access blocked:", result.risk_reasons);
709
+ * }
710
+ * ```
711
+ */
712
+ verifyIP(request: VerifyIPRequest): Promise<LocationVerification>;
713
+ /**
714
+ * Check compliance for a specific country
715
+ *
716
+ * @param countryISO - ISO 3166-1 alpha-2 country code (e.g., "US", "GB")
717
+ * @returns Jurisdiction configuration and compliance status
718
+ *
719
+ * @example
720
+ * ```typescript
721
+ * const compliance = await client.checkCompliance("KP"); // North Korea
722
+ * if (!compliance.is_compliant) {
723
+ * console.log("Country is not allowed:", compliance.jurisdiction?.status);
724
+ * }
725
+ * ```
726
+ */
727
+ checkCompliance(countryISO: string): Promise<ComplianceCheckResponse>;
728
+ /**
729
+ * Validate a cipherText generated by the frontend SDK
730
+ *
731
+ * The cipherText contains encrypted device fingerprint and optional location data.
732
+ * This method decrypts and validates the data, returning device info, location,
733
+ * and risk assessment.
734
+ *
735
+ * @param cipherText - The encrypted cipherText string from generateCipherText()
736
+ * @param userId - User ID associated with this verification
737
+ * @param eventType - Reason for verification (login, registration, etc.)
738
+ * @param expectedIP - Optional expected IP address for additional validation
739
+ * @returns Validation result with device info, location, and risk assessment
740
+ *
741
+ * @example
742
+ * ```typescript
743
+ * // Validate cipherText during login
744
+ * const result = await client.validateCipherText(
745
+ * cipherText,
746
+ * "user_123",
747
+ * "login"
748
+ * );
749
+ *
750
+ * if (!result.valid) {
751
+ * console.log("CipherText validation failed:", result.errors);
752
+ * return;
753
+ * }
754
+ *
755
+ * console.log("Device UUID:", result.device_uuid);
756
+ * console.log("IP Address:", result.ip_address);
757
+ * console.log("Risk Level:", result.risk.level);
758
+ *
759
+ * if (result.risk.is_vpn) {
760
+ * console.log("VPN detected");
761
+ * }
762
+ * ```
763
+ */
764
+ validateCipherText(cipherText: string, userId: string, eventType: CipherTextReason, expectedIP?: string): Promise<ValidateCipherTextResponse>;
765
+ /**
766
+ * Validate cipherText and verify IP in a single call
767
+ *
768
+ * Combines cipherText validation with IP verification for complete
769
+ * location and device verification in one request.
770
+ *
771
+ * @param cipherText - The encrypted cipherText string
772
+ * @param ipAddress - Client IP address
773
+ * @param userId - User ID
774
+ * @param eventType - Event type (login, registration, etc.)
775
+ * @returns Combined validation and verification result
776
+ *
777
+ * @example
778
+ * ```typescript
779
+ * const result = await client.validateAndVerify(
780
+ * cipherText,
781
+ * clientIP,
782
+ * "user_123",
783
+ * "registration"
784
+ * );
785
+ *
786
+ * if (!result.ciphertext_valid) {
787
+ * throw new Error("Device verification failed");
788
+ * }
789
+ *
790
+ * if (result.location.is_blocked) {
791
+ * throw new Error("Location not allowed");
792
+ * }
793
+ * ```
794
+ */
795
+ validateAndVerify(cipherText: string, ipAddress: string, userId: string, eventType: CipherTextReason): Promise<{
796
+ ciphertext_valid: boolean;
797
+ ciphertext_result: ValidateCipherTextResponse;
798
+ location: LocationVerification;
799
+ }>;
800
+ /**
801
+ * Get location history for a user
802
+ *
803
+ * @param userId - User ID to retrieve history for
804
+ * @param limit - Maximum number of records to return (default: 100)
805
+ * @returns Array of geolocation records
806
+ */
807
+ getUserLocationHistory(userId: string, limit?: number): Promise<GeolocationRecord[]>;
808
+ /**
809
+ * Get a specific alert by ID
810
+ *
811
+ * @param alertId - Alert ID
812
+ * @returns Alert details
813
+ */
814
+ getAlert(alertId: string): Promise<GeolocationAlert>;
815
+ /**
816
+ * List alerts with filters and pagination
817
+ *
818
+ * @param filters - Optional filters (status, severity, type, user, dates)
819
+ * @param pagination - Optional pagination (page, page_size)
820
+ * @returns Paginated list of alerts
821
+ *
822
+ * @example
823
+ * ```typescript
824
+ * const alerts = await client.listAlerts(
825
+ * { status: "active", severity: "critical" },
826
+ * { page: 1, page_size: 20 }
827
+ * );
828
+ * console.log(`Found ${alerts.total} critical alerts`);
829
+ * ```
830
+ */
831
+ listAlerts(filters?: AlertFilters, pagination?: PaginationParams): Promise<AlertListResponse>;
832
+ /**
833
+ * Update alert status
834
+ *
835
+ * @param alertId - Alert ID
836
+ * @param status - New status
837
+ */
838
+ updateAlertStatus(alertId: string, status: AlertStatus): Promise<void>;
839
+ /**
840
+ * Assign an alert to an analyst
841
+ *
842
+ * @param alertId - Alert ID
843
+ * @param assignedTo - User ID to assign to
844
+ */
845
+ assignAlert(alertId: string, assignedTo: string): Promise<void>;
846
+ /**
847
+ * Resolve an alert
848
+ *
849
+ * @param alertId - Alert ID
850
+ * @param resolution - Resolution type
851
+ * @param notes - Optional notes
852
+ */
853
+ resolveAlert(alertId: string, resolution: string, notes?: string): Promise<void>;
854
+ /**
855
+ * Dismiss an alert as false positive
856
+ *
857
+ * @param alertId - Alert ID
858
+ * @param notes - Optional notes explaining why it's a false positive
859
+ */
860
+ dismissAlert(alertId: string, notes?: string): Promise<void>;
861
+ /**
862
+ * Escalate an alert to higher severity or different assignee
863
+ *
864
+ * @param alertId - Alert ID
865
+ * @param assignedTo - New assignee user ID
866
+ * @param severity - New severity level
867
+ * @param notes - Escalation notes
868
+ */
869
+ escalateAlert(alertId: string, assignedTo: string, severity: string, notes: string): Promise<void>;
870
+ /**
871
+ * Block an alert (mark as blocked)
872
+ *
873
+ * @param alertId - Alert ID
874
+ * @param notes - Optional notes
875
+ */
876
+ blockAlert(alertId: string, notes?: string): Promise<void>;
877
+ /**
878
+ * Get dashboard metrics
879
+ *
880
+ * @param timeRangeHours - Time range in hours (default: 24)
881
+ * @returns Dashboard metrics and statistics
882
+ *
883
+ * @example
884
+ * ```typescript
885
+ * const metrics = await client.getDashboardMetrics(168); // Last 7 days
886
+ * console.log(`${metrics.critical_alerts} critical alerts in last week`);
887
+ * ```
888
+ */
889
+ getDashboardMetrics(timeRangeHours?: number): Promise<DashboardMetrics>;
890
+ /**
891
+ * List all jurisdiction configurations
892
+ *
893
+ * @returns Array of jurisdiction configurations
894
+ */
895
+ listJurisdictions(): Promise<JurisdictionConfig[]>;
896
+ /**
897
+ * Get a jurisdiction configuration by ID
898
+ *
899
+ * @param jurisdictionId - Jurisdiction ID
900
+ * @returns Jurisdiction configuration
901
+ */
902
+ getJurisdiction(jurisdictionId: string): Promise<JurisdictionConfig>;
903
+ /**
904
+ * Create a new jurisdiction configuration
905
+ *
906
+ * @param request - Jurisdiction configuration data
907
+ * @returns Created jurisdiction
908
+ *
909
+ * @example
910
+ * ```typescript
911
+ * const jurisdiction = await client.createJurisdiction({
912
+ * country_iso: "US",
913
+ * country_name: "United States",
914
+ * status: "allowed",
915
+ * risk_level: "low",
916
+ * allow_login: true,
917
+ * allow_registration: true,
918
+ * allow_transactions: true,
919
+ * require_kyc: false,
920
+ * require_enhanced_verification: false
921
+ * });
922
+ * ```
923
+ */
924
+ createJurisdiction(request: CreateJurisdictionRequest): Promise<JurisdictionConfig>;
925
+ /**
926
+ * Update a jurisdiction configuration
927
+ *
928
+ * @param jurisdictionId - Jurisdiction ID
929
+ * @param request - Updated fields
930
+ * @returns Updated jurisdiction
931
+ */
932
+ updateJurisdiction(jurisdictionId: string, request: UpdateJurisdictionRequest): Promise<JurisdictionConfig>;
933
+ /**
934
+ * Delete a jurisdiction configuration
935
+ *
936
+ * @param jurisdictionId - Jurisdiction ID
937
+ */
938
+ deleteJurisdiction(jurisdictionId: string): Promise<void>;
939
+ /**
940
+ * List all geofence rules
941
+ *
942
+ * @returns Array of geofence rules
943
+ */
944
+ listGeofenceRules(): Promise<GeofenceRule[]>;
945
+ /**
946
+ * Get a geofence rule by ID
947
+ *
948
+ * @param ruleId - Geofence rule ID
949
+ * @returns Geofence rule
950
+ */
951
+ getGeofenceRule(ruleId: string): Promise<GeofenceRule>;
952
+ /**
953
+ * Create a new geofence rule
954
+ *
955
+ * @param request - Geofence rule data
956
+ * @returns Created geofence rule
957
+ *
958
+ * @example
959
+ * ```typescript
960
+ * const rule = await client.createGeofenceRule({
961
+ * name: "Block High Risk Countries",
962
+ * rule_type: "block_list",
963
+ * action: "block",
964
+ * countries: ["KP", "IR", "SY"],
965
+ * event_types: ["login", "transaction"],
966
+ * priority: 100
967
+ * });
968
+ * ```
969
+ */
970
+ createGeofenceRule(request: CreateGeofenceRuleRequest): Promise<GeofenceRule>;
971
+ /**
972
+ * Update a geofence rule
973
+ *
974
+ * @param ruleId - Geofence rule ID
975
+ * @param request - Updated fields
976
+ * @returns Updated geofence rule
977
+ */
978
+ updateGeofenceRule(ruleId: string, request: UpdateGeofenceRuleRequest): Promise<GeofenceRule>;
979
+ /**
980
+ * Delete a geofence rule
981
+ *
982
+ * @param ruleId - Geofence rule ID
983
+ */
984
+ deleteGeofenceRule(ruleId: string): Promise<void>;
985
+ /**
986
+ * Get all devices for a user
987
+ *
988
+ * @param userId - User ID
989
+ * @returns Array of device fingerprints
990
+ */
991
+ getUserDevices(userId: string): Promise<DeviceFingerprint[]>;
992
+ /**
993
+ * Get a specific device by device ID
994
+ *
995
+ * @param deviceId - Device ID
996
+ * @returns Device fingerprint
997
+ */
998
+ getDevice(deviceId: string): Promise<DeviceFingerprint>;
999
+ /**
1000
+ * Update device trust status
1001
+ *
1002
+ * @param deviceId - Device ID
1003
+ * @param action - "trust" or "untrust"
1004
+ *
1005
+ * @example
1006
+ * ```typescript
1007
+ * // Mark a device as trusted
1008
+ * await client.updateDeviceTrust("device_abc", "trust");
1009
+ *
1010
+ * // Mark a device as untrusted
1011
+ * await client.updateDeviceTrust("device_xyz", "untrust");
1012
+ * ```
1013
+ */
1014
+ updateDeviceTrust(deviceId: string, action: 'trust' | 'untrust'): Promise<void>;
1015
+ /**
1016
+ * Create a location request to get customer's live location
1017
+ *
1018
+ * @param request - Location request details
1019
+ * @returns Location request result with share link
1020
+ *
1021
+ * @example
1022
+ * ```typescript
1023
+ * const result = await client.createLocationRequest({
1024
+ * user_id: "customer_123",
1025
+ * channel: "sms",
1026
+ * phone: "+1234567890",
1027
+ * reason: "Verification for high-value transaction"
1028
+ * });
1029
+ *
1030
+ * console.log(`Share link sent: ${result.share_link}`);
1031
+ * console.log(`Expires at: ${result.token_expiry}`);
1032
+ * ```
1033
+ */
1034
+ createLocationRequest(request: CreateLocationRequestRequest): Promise<LocationRequestResult>;
1035
+ /**
1036
+ * Get a location request by ID
1037
+ *
1038
+ * @param requestId - Location request ID
1039
+ * @returns Location request details
1040
+ */
1041
+ getLocationRequest(requestId: string): Promise<LocationRequest>;
1042
+ /**
1043
+ * List location requests with filters and pagination
1044
+ *
1045
+ * @param filters - Optional filters
1046
+ * @param pagination - Optional pagination
1047
+ * @returns Paginated list of location requests
1048
+ *
1049
+ * @example
1050
+ * ```typescript
1051
+ * const requests = await client.listLocationRequests(
1052
+ * { status: "completed", user_id: "customer_123" },
1053
+ * { page: 1, limit: 20 }
1054
+ * );
1055
+ * ```
1056
+ */
1057
+ listLocationRequests(filters?: LocationRequestFilters, pagination?: PaginationParams): Promise<LocationRequestListResponse>;
1058
+ /**
1059
+ * Cancel a pending location request
1060
+ *
1061
+ * @param requestId - Location request ID
1062
+ */
1063
+ cancelLocationRequest(requestId: string): Promise<void>;
1064
+ /**
1065
+ * Resend notification for a location request
1066
+ *
1067
+ * @param requestId - Location request ID
1068
+ * @param contact - Email or phone to send to
1069
+ */
1070
+ resendLocationRequest(requestId: string, contact: ResendLocationRequestRequest): Promise<void>;
1071
+ /**
1072
+ * Get location share info (customer-facing)
1073
+ * This is called from the customer's device to get request details
1074
+ *
1075
+ * @param token - Secure token from share link
1076
+ * @returns Location share info
1077
+ */
1078
+ getLocationShareInfo(token: string): Promise<LocationShareInfo>;
1079
+ /**
1080
+ * Submit location capture (customer-facing)
1081
+ * This is called from the customer's device to submit their location
1082
+ *
1083
+ * @param token - Secure token from share link
1084
+ * @param capture - Location capture data (GPS or WiFi)
1085
+ * @returns Capture response
1086
+ *
1087
+ * @example
1088
+ * ```typescript
1089
+ * // Using GPS (preferred)
1090
+ * const result = await client.captureLocation(token, {
1091
+ * latitude: 37.7749,
1092
+ * longitude: -122.4194,
1093
+ * accuracy: 10
1094
+ * });
1095
+ *
1096
+ * // Using WiFi positioning (fallback)
1097
+ * const result = await client.captureLocation(token, {
1098
+ * wifi_networks: [
1099
+ * { macAddress: "00:11:22:33:44:55", signalStrength: -50 },
1100
+ * { macAddress: "AA:BB:CC:DD:EE:FF", signalStrength: -70 }
1101
+ * ]
1102
+ * });
1103
+ * ```
1104
+ */
1105
+ captureLocation(token: string, capture: LocationCaptureRequest): Promise<LocationCaptureResponse>;
1106
+ }
1107
+
1108
+ export { type UseLocationCaptureOptions as $, type AlertStatus as A, type GeolocationClientConfig as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type UseGeolocationOptions as E, type UseGeolocationResult as F, GeolocationClient as G, type UseAlertsOptions as H, type UseAlertsResult as I, type JurisdictionConfig as J, type LocationRequestStatus as K, type LocationVerification as L, type LocationRequestChannel as M, type LocationRequest as N, type CreateLocationRequestRequest as O, type LocationRequestResult as P, type LocationRequestFilters as Q, type LocationRequestListResponse as R, type ResendLocationRequestRequest as S, type LocationCaptureRequest as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type WiFiNetwork as W, type LocationShareInfo as X, type LocationCaptureResponse as Y, type UseLocationRequestsOptions as Z, type UseLocationRequestsResult as _, type CipherTextReason as a, type UseLocationCaptureResult as a0, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type ValidateCipherTextResponse as e, type VerifyIPRequest as f, type GeoIPResult as g, type GeofenceEvaluation as h, type DeviceFingerprint as i, type DeviceTrustResult as j, type ComplianceCheckResponse as k, type AlertSeverity as l, type AlertType as m, type GeolocationAlert as n, type AlertFilters as o, type AlertListResponse as p, type DashboardMetrics as q, type CreateJurisdictionRequest as r, type GeofenceRuleType as s, type GeofenceAction as t, type GeofenceRule as u, type CreateGeofenceRuleRequest as v, type UpdateGeofenceRuleRequest as w, type UpdateDeviceTrustRequest as x, type GeolocationRecord as y, type APIError as z };