vesant-sdk 1.0.8 → 1.1.1

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 +149 -29
  2. package/dist/{client-D0xQUtlw.d.ts → client-BfeDYmrZ.d.mts} +60 -237
  3. package/dist/{client-C2JxOxLE.d.mts → client-i5QtnFIa.d.ts} +60 -237
  4. package/dist/compliance/index.d.mts +25 -158
  5. package/dist/compliance/index.d.ts +25 -158
  6. package/dist/compliance/index.js +347 -842
  7. package/dist/compliance/index.js.map +1 -1
  8. package/dist/compliance/index.mjs +347 -842
  9. package/dist/compliance/index.mjs.map +1 -1
  10. package/dist/geolocation/index.d.mts +5 -25
  11. package/dist/geolocation/index.d.ts +5 -25
  12. package/dist/geolocation/index.js +222 -406
  13. package/dist/geolocation/index.js.map +1 -1
  14. package/dist/geolocation/index.mjs +223 -406
  15. package/dist/geolocation/index.mjs.map +1 -1
  16. package/dist/index.d.mts +16 -7
  17. package/dist/index.d.ts +16 -7
  18. package/dist/index.js +444 -940
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +442 -940
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/kyc/core.d.mts +2 -2
  23. package/dist/kyc/core.d.ts +2 -2
  24. package/dist/kyc/core.js +118 -36
  25. package/dist/kyc/core.js.map +1 -1
  26. package/dist/kyc/core.mjs +118 -36
  27. package/dist/kyc/core.mjs.map +1 -1
  28. package/dist/kyc/index.d.mts +2 -2
  29. package/dist/kyc/index.d.ts +2 -2
  30. package/dist/kyc/index.js +118 -36
  31. package/dist/kyc/index.js.map +1 -1
  32. package/dist/kyc/index.mjs +118 -36
  33. package/dist/kyc/index.mjs.map +1 -1
  34. package/dist/react.d.mts +172 -149
  35. package/dist/react.d.ts +172 -149
  36. package/dist/react.js +544 -481
  37. package/dist/react.js.map +1 -1
  38. package/dist/react.mjs +542 -481
  39. package/dist/react.mjs.map +1 -1
  40. package/dist/risk-profile/index.d.mts +11 -146
  41. package/dist/risk-profile/index.d.ts +11 -146
  42. package/dist/risk-profile/index.js +137 -255
  43. package/dist/risk-profile/index.js.map +1 -1
  44. package/dist/risk-profile/index.mjs +137 -255
  45. package/dist/risk-profile/index.mjs.map +1 -1
  46. package/dist/{types-Bnsnejor.d.mts → types-BpKxSXGF.d.mts} +31 -4
  47. package/dist/{types-Bnsnejor.d.ts → types-BpKxSXGF.d.ts} +31 -4
  48. package/dist/{types-CqOLbaXk.d.mts → types-DKCQN4C5.d.mts} +1 -1
  49. package/dist/{types-CFupjwi8.d.ts → types-DfHLp_tz.d.ts} +1 -1
  50. package/package.json +11 -7
@@ -1,13 +1,4 @@
1
- import { P as PaginationParams, B as BaseClient } from './types-Bnsnejor.js';
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
- */
1
+ import { b as Logger, P as PaginationParams, B as BaseClient, R as RequestOptions } from './types-BpKxSXGF.mjs';
11
2
 
12
3
  interface DeviceFingerprintRequest {
13
4
  device_id: string;
@@ -203,6 +194,10 @@ interface ValidateCipherTextResponse {
203
194
  is_blocked: boolean;
204
195
  /** Reasons for blocking (only present if is_blocked is true) */
205
196
  block_reasons?: string[];
197
+ /** GPS-vs-IP location mismatch detected (possible spoofing) */
198
+ location_mismatch?: boolean;
199
+ /** Distance in km between GPS and IP-derived location */
200
+ location_mismatch_distance_km?: number;
206
201
  };
207
202
  errors?: string[];
208
203
  }
@@ -445,6 +440,16 @@ interface APIError {
445
440
  message?: string;
446
441
  details?: Record<string, unknown>;
447
442
  }
443
+ /**
444
+ * GPS requirement configuration per event type, returned by GET /api/v1/geo/config
445
+ */
446
+ interface GeolocationConfigResponse {
447
+ require_gps: {
448
+ login: boolean;
449
+ registration: boolean;
450
+ transaction: boolean;
451
+ };
452
+ }
448
453
  interface GeolocationClientConfig {
449
454
  /** Base URL of the API Gateway (e.g., "https://api.example.com") */
450
455
  baseURL: string;
@@ -458,6 +463,8 @@ interface GeolocationClientConfig {
458
463
  timeout?: number;
459
464
  /** Enable debug logging */
460
465
  debug?: boolean;
466
+ /** Custom logger instance */
467
+ logger?: Logger;
461
468
  }
462
469
  interface UseGeolocationOptions {
463
470
  /** Auto-detect and verify user's IP on mount */
@@ -466,6 +473,8 @@ interface UseGeolocationOptions {
466
473
  eventType?: string;
467
474
  /** Include device fingerprint in verification */
468
475
  includeDeviceFingerprint?: boolean;
476
+ /** User ID to include in verification requests */
477
+ userId?: string;
469
478
  }
470
479
  interface UseGeolocationResult {
471
480
  /** Current verification result */
@@ -624,6 +633,18 @@ interface LocationCaptureResponse {
624
633
  latitude?: number;
625
634
  longitude?: number;
626
635
  accuracy?: number;
636
+ /** Resolved country name (from Nominatim or MaxMind fallback) */
637
+ country?: string;
638
+ /** ISO country code */
639
+ country_iso?: string;
640
+ /** Resolved city name */
641
+ city?: string;
642
+ /** Resolved region/state name */
643
+ region?: string;
644
+ /** GPS-vs-IP location mismatch detected (possible spoofing) */
645
+ location_mismatch?: boolean;
646
+ /** Distance in km between GPS and IP-derived location */
647
+ mismatch_distance_km?: number;
627
648
  }
628
649
  interface UseLocationRequestsOptions {
629
650
  /** Auto-fetch location requests on mount */
@@ -742,7 +763,7 @@ declare class GeolocationClient extends BaseClient {
742
763
  * }
743
764
  * ```
744
765
  */
745
- verifyIP(request: VerifyIPRequest): Promise<LocationVerification>;
766
+ verifyIP(request: VerifyIPRequest, requestOptions?: RequestOptions): Promise<LocationVerification>;
746
767
  /**
747
768
  * Check compliance for a specific country
748
769
  *
@@ -757,7 +778,24 @@ declare class GeolocationClient extends BaseClient {
757
778
  * }
758
779
  * ```
759
780
  */
760
- checkCompliance(countryISO: string): Promise<ComplianceCheckResponse>;
781
+ checkCompliance(countryISO: string, requestOptions?: RequestOptions): Promise<ComplianceCheckResponse>;
782
+ /**
783
+ * Get the tenant's GPS requirement configuration
784
+ *
785
+ * Returns which event types require GPS location to be collected.
786
+ * Use this to auto-enable GPS collection in generateCipherText when required.
787
+ *
788
+ * @returns GPS requirement config per event type
789
+ *
790
+ * @example
791
+ * ```typescript
792
+ * const config = await client.getGPSConfig();
793
+ * if (config.require_gps.login) {
794
+ * // GPS is required for login — auto-enable location
795
+ * }
796
+ * ```
797
+ */
798
+ getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
761
799
  /**
762
800
  * Validate a cipherText generated by the frontend SDK
763
801
  *
@@ -799,7 +837,7 @@ declare class GeolocationClient extends BaseClient {
799
837
  * }
800
838
  * ```
801
839
  */
802
- validateCipherText(cipherText: string, userId: string, eventType: CipherTextReason, expectedIP?: string, customerData?: CipherTextCustomerData): Promise<ValidateCipherTextResponse>;
840
+ validateCipherText(cipherText: string, userId: string, eventType: CipherTextReason, expectedIP?: string, customerData?: CipherTextCustomerData, requestOptions?: RequestOptions): Promise<ValidateCipherTextResponse>;
803
841
  /**
804
842
  * Validate cipherText and verify IP in a single call
805
843
  *
@@ -830,226 +868,11 @@ declare class GeolocationClient extends BaseClient {
830
868
  * }
831
869
  * ```
832
870
  */
833
- validateAndVerify(cipherText: string, ipAddress: string, userId: string, eventType: CipherTextReason): Promise<{
871
+ validateAndVerify(cipherText: string, ipAddress: string, userId: string, eventType: CipherTextReason, requestOptions?: RequestOptions): Promise<{
834
872
  ciphertext_valid: boolean;
835
873
  ciphertext_result: ValidateCipherTextResponse;
836
874
  location: LocationVerification;
837
875
  }>;
838
- /**
839
- * Get location history for a user
840
- *
841
- * @param userId - User ID to retrieve history for
842
- * @param limit - Maximum number of records to return (default: 100)
843
- * @returns Array of geolocation records
844
- */
845
- getUserLocationHistory(userId: string, limit?: number): Promise<GeolocationRecord[]>;
846
- /**
847
- * Get a specific alert by ID
848
- *
849
- * @param alertId - Alert ID
850
- * @returns Alert details
851
- */
852
- getAlert(alertId: string): Promise<GeolocationAlert>;
853
- /**
854
- * List alerts with filters and pagination
855
- *
856
- * @param filters - Optional filters (status, severity, type, user, dates)
857
- * @param pagination - Optional pagination (page, page_size)
858
- * @returns Paginated list of alerts
859
- *
860
- * @example
861
- * ```typescript
862
- * const alerts = await client.listAlerts(
863
- * { status: "active", severity: "critical" },
864
- * { page: 1, page_size: 20 }
865
- * );
866
- * console.log(`Found ${alerts.total} critical alerts`);
867
- * ```
868
- */
869
- listAlerts(filters?: AlertFilters, pagination?: PaginationParams): Promise<AlertListResponse>;
870
- /**
871
- * Update alert status
872
- *
873
- * @param alertId - Alert ID
874
- * @param status - New status
875
- */
876
- updateAlertStatus(alertId: string, status: AlertStatus): Promise<void>;
877
- /**
878
- * Assign an alert to an analyst
879
- *
880
- * @param alertId - Alert ID
881
- * @param assignedTo - User ID to assign to
882
- */
883
- assignAlert(alertId: string, assignedTo: string): Promise<void>;
884
- /**
885
- * Resolve an alert
886
- *
887
- * @param alertId - Alert ID
888
- * @param resolution - Resolution type
889
- * @param notes - Optional notes
890
- */
891
- resolveAlert(alertId: string, resolution: string, notes?: string): Promise<void>;
892
- /**
893
- * Dismiss an alert as false positive
894
- *
895
- * @param alertId - Alert ID
896
- * @param notes - Optional notes explaining why it's a false positive
897
- */
898
- dismissAlert(alertId: string, notes?: string): Promise<void>;
899
- /**
900
- * Escalate an alert to higher severity or different assignee
901
- *
902
- * @param alertId - Alert ID
903
- * @param assignedTo - New assignee user ID
904
- * @param severity - New severity level
905
- * @param notes - Escalation notes
906
- */
907
- escalateAlert(alertId: string, assignedTo: string, severity: string, notes: string): Promise<void>;
908
- /**
909
- * Block an alert (mark as blocked)
910
- *
911
- * @param alertId - Alert ID
912
- * @param notes - Optional notes
913
- */
914
- blockAlert(alertId: string, notes?: string): Promise<void>;
915
- /**
916
- * Get dashboard metrics
917
- *
918
- * @param timeRangeHours - Time range in hours (default: 24)
919
- * @returns Dashboard metrics and statistics
920
- *
921
- * @example
922
- * ```typescript
923
- * const metrics = await client.getDashboardMetrics(168); // Last 7 days
924
- * console.log(`${metrics.critical_alerts} critical alerts in last week`);
925
- * ```
926
- */
927
- getDashboardMetrics(timeRangeHours?: number): Promise<DashboardMetrics>;
928
- /**
929
- * List all jurisdiction configurations
930
- *
931
- * @returns Array of jurisdiction configurations
932
- */
933
- listJurisdictions(): Promise<JurisdictionConfig[]>;
934
- /**
935
- * Get a jurisdiction configuration by ID
936
- *
937
- * @param jurisdictionId - Jurisdiction ID
938
- * @returns Jurisdiction configuration
939
- */
940
- getJurisdiction(jurisdictionId: string): Promise<JurisdictionConfig>;
941
- /**
942
- * Create a new jurisdiction configuration
943
- *
944
- * @param request - Jurisdiction configuration data
945
- * @returns Created jurisdiction
946
- *
947
- * @example
948
- * ```typescript
949
- * const jurisdiction = await client.createJurisdiction({
950
- * country_iso: "US",
951
- * country_name: "United States",
952
- * status: "allowed",
953
- * risk_level: "low",
954
- * allow_login: true,
955
- * allow_registration: true,
956
- * allow_transactions: true,
957
- * require_kyc: false,
958
- * require_enhanced_verification: false
959
- * });
960
- * ```
961
- */
962
- createJurisdiction(request: CreateJurisdictionRequest): Promise<JurisdictionConfig>;
963
- /**
964
- * Update a jurisdiction configuration
965
- *
966
- * @param jurisdictionId - Jurisdiction ID
967
- * @param request - Updated fields
968
- * @returns Updated jurisdiction
969
- */
970
- updateJurisdiction(jurisdictionId: string, request: UpdateJurisdictionRequest): Promise<JurisdictionConfig>;
971
- /**
972
- * Delete a jurisdiction configuration
973
- *
974
- * @param jurisdictionId - Jurisdiction ID
975
- */
976
- deleteJurisdiction(jurisdictionId: string): Promise<void>;
977
- /**
978
- * List all geofence rules
979
- *
980
- * @returns Array of geofence rules
981
- */
982
- listGeofenceRules(): Promise<GeofenceRule[]>;
983
- /**
984
- * Get a geofence rule by ID
985
- *
986
- * @param ruleId - Geofence rule ID
987
- * @returns Geofence rule
988
- */
989
- getGeofenceRule(ruleId: string): Promise<GeofenceRule>;
990
- /**
991
- * Create a new geofence rule
992
- *
993
- * @param request - Geofence rule data
994
- * @returns Created geofence rule
995
- *
996
- * @example
997
- * ```typescript
998
- * const rule = await client.createGeofenceRule({
999
- * name: "Block High Risk Countries",
1000
- * rule_type: "block_list",
1001
- * action: "block",
1002
- * countries: ["KP", "IR", "SY"],
1003
- * event_types: ["login", "transaction"],
1004
- * priority: 100
1005
- * });
1006
- * ```
1007
- */
1008
- createGeofenceRule(request: CreateGeofenceRuleRequest): Promise<GeofenceRule>;
1009
- /**
1010
- * Update a geofence rule
1011
- *
1012
- * @param ruleId - Geofence rule ID
1013
- * @param request - Updated fields
1014
- * @returns Updated geofence rule
1015
- */
1016
- updateGeofenceRule(ruleId: string, request: UpdateGeofenceRuleRequest): Promise<GeofenceRule>;
1017
- /**
1018
- * Delete a geofence rule
1019
- *
1020
- * @param ruleId - Geofence rule ID
1021
- */
1022
- deleteGeofenceRule(ruleId: string): Promise<void>;
1023
- /**
1024
- * Get all devices for a user
1025
- *
1026
- * @param userId - User ID
1027
- * @returns Array of device fingerprints
1028
- */
1029
- getUserDevices(userId: string): Promise<DeviceFingerprint[]>;
1030
- /**
1031
- * Get a specific device by device ID
1032
- *
1033
- * @param deviceId - Device ID
1034
- * @returns Device fingerprint
1035
- */
1036
- getDevice(deviceId: string): Promise<DeviceFingerprint>;
1037
- /**
1038
- * Update device trust status
1039
- *
1040
- * @param deviceId - Device ID
1041
- * @param action - "trust" or "untrust"
1042
- *
1043
- * @example
1044
- * ```typescript
1045
- * // Mark a device as trusted
1046
- * await client.updateDeviceTrust("device_abc", "trust");
1047
- *
1048
- * // Mark a device as untrusted
1049
- * await client.updateDeviceTrust("device_xyz", "untrust");
1050
- * ```
1051
- */
1052
- updateDeviceTrust(deviceId: string, action: 'trust' | 'untrust'): Promise<void>;
1053
876
  /**
1054
877
  * Create a location request to get customer's live location
1055
878
  *
@@ -1069,14 +892,14 @@ declare class GeolocationClient extends BaseClient {
1069
892
  * console.log(`Expires at: ${result.token_expiry}`);
1070
893
  * ```
1071
894
  */
1072
- createLocationRequest(request: CreateLocationRequestRequest): Promise<LocationRequestResult>;
895
+ createLocationRequest(request: CreateLocationRequestRequest, requestOptions?: RequestOptions): Promise<LocationRequestResult>;
1073
896
  /**
1074
897
  * Get a location request by ID
1075
898
  *
1076
899
  * @param requestId - Location request ID
1077
900
  * @returns Location request details
1078
901
  */
1079
- getLocationRequest(requestId: string): Promise<LocationRequest>;
902
+ getLocationRequest(requestId: string, requestOptions?: RequestOptions): Promise<LocationRequest>;
1080
903
  /**
1081
904
  * List location requests with filters and pagination
1082
905
  *
@@ -1092,20 +915,20 @@ declare class GeolocationClient extends BaseClient {
1092
915
  * );
1093
916
  * ```
1094
917
  */
1095
- listLocationRequests(filters?: LocationRequestFilters, pagination?: PaginationParams): Promise<LocationRequestListResponse>;
918
+ listLocationRequests(filters?: LocationRequestFilters, pagination?: PaginationParams, requestOptions?: RequestOptions): Promise<LocationRequestListResponse>;
1096
919
  /**
1097
920
  * Cancel a pending location request
1098
921
  *
1099
922
  * @param requestId - Location request ID
1100
923
  */
1101
- cancelLocationRequest(requestId: string): Promise<void>;
924
+ cancelLocationRequest(requestId: string, requestOptions?: RequestOptions): Promise<void>;
1102
925
  /**
1103
926
  * Resend notification for a location request
1104
927
  *
1105
928
  * @param requestId - Location request ID
1106
929
  * @param contact - Email or phone to send to
1107
930
  */
1108
- resendLocationRequest(requestId: string, contact: ResendLocationRequestRequest): Promise<void>;
931
+ resendLocationRequest(requestId: string, contact: ResendLocationRequestRequest, requestOptions?: RequestOptions): Promise<void>;
1109
932
  /**
1110
933
  * Get location share info (customer-facing)
1111
934
  * This is called from the customer's device to get request details
@@ -1113,7 +936,7 @@ declare class GeolocationClient extends BaseClient {
1113
936
  * @param token - Secure token from share link
1114
937
  * @returns Location share info
1115
938
  */
1116
- getLocationShareInfo(token: string): Promise<LocationShareInfo>;
939
+ getLocationShareInfo(token: string, requestOptions?: RequestOptions): Promise<LocationShareInfo>;
1117
940
  /**
1118
941
  * Submit location capture (customer-facing)
1119
942
  * This is called from the customer's device to submit their location
@@ -1140,7 +963,7 @@ declare class GeolocationClient extends BaseClient {
1140
963
  * });
1141
964
  * ```
1142
965
  */
1143
- captureLocation(token: string, capture: LocationCaptureRequest): Promise<LocationCaptureResponse>;
966
+ captureLocation(token: string, capture: LocationCaptureRequest, requestOptions?: RequestOptions): Promise<LocationCaptureResponse>;
1144
967
  }
1145
968
 
1146
- export { type UseLocationRequestsResult as $, type AlertStatus as A, type APIError as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type GeolocationClientConfig as E, type UseGeolocationOptions as F, GeolocationClient as G, type UseGeolocationResult as H, type UseAlertsOptions as I, type JurisdictionConfig as J, type UseAlertsResult as K, type LocationVerification as L, type LocationRequestStatus as M, type LocationRequestChannel as N, type LocationRequest as O, type CreateLocationRequestRequest as P, type LocationRequestResult as Q, type LocationRequestFilters as R, type LocationRequestListResponse as S, type ResendLocationRequestRequest as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type WiFiNetwork as W, type LocationCaptureRequest as X, type LocationShareInfo as Y, type LocationCaptureResponse as Z, type UseLocationRequestsOptions as _, type CipherTextReason as a, type UseLocationCaptureOptions as a0, type UseLocationCaptureResult as a1, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type CipherTextCustomerData as e, type ValidateCipherTextResponse as f, type VerifyIPRequest as g, type GeoIPResult as h, type GeofenceEvaluation as i, type DeviceFingerprint as j, type DeviceTrustResult as k, type ComplianceCheckResponse as l, type AlertSeverity as m, type AlertType as n, type GeolocationAlert as o, type AlertFilters as p, type AlertListResponse as q, type DashboardMetrics as r, type CreateJurisdictionRequest as s, type GeofenceRuleType as t, type GeofenceAction as u, type GeofenceRule as v, type CreateGeofenceRuleRequest as w, type UpdateGeofenceRuleRequest as x, type UpdateDeviceTrustRequest as y, type GeolocationRecord as z };
969
+ export { type UseLocationRequestsOptions as $, type AlertStatus as A, type APIError as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type GeolocationConfigResponse as E, type GeolocationClientConfig as F, GeolocationClient as G, type UseGeolocationOptions as H, type UseGeolocationResult as I, type JurisdictionConfig as J, type UseAlertsOptions as K, type LocationVerification as L, type UseAlertsResult as M, type LocationRequestStatus as N, type LocationRequestChannel as O, type LocationRequest as P, type CreateLocationRequestRequest as Q, type LocationRequestResult as R, type LocationRequestFilters as S, type LocationRequestListResponse as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type ResendLocationRequestRequest as W, type WiFiNetwork as X, type LocationCaptureRequest as Y, type LocationShareInfo as Z, type LocationCaptureResponse as _, type CipherTextReason as a, type UseLocationRequestsResult as a0, type UseLocationCaptureOptions as a1, type UseLocationCaptureResult as a2, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type CipherTextCustomerData as e, type ValidateCipherTextResponse as f, type VerifyIPRequest as g, type GeoIPResult as h, type GeofenceEvaluation as i, type DeviceFingerprint as j, type DeviceTrustResult as k, type ComplianceCheckResponse as l, type AlertSeverity as m, type AlertType as n, type GeolocationAlert as o, type AlertFilters as p, type AlertListResponse as q, type DashboardMetrics as r, type CreateJurisdictionRequest as s, type GeofenceRuleType as t, type GeofenceAction as u, type GeofenceRule as v, type CreateGeofenceRuleRequest as w, type UpdateGeofenceRuleRequest as x, type UpdateDeviceTrustRequest as y, type GeolocationRecord as z };