diff --git a/src/api/verify.ts b/src/api/verify.ts index b4b2261..7f38f2f 100644 --- a/src/api/verify.ts +++ b/src/api/verify.ts @@ -12,6 +12,8 @@ let tokenTimeoutId: any | null = null; let tokenCallback: ((token: RadarTrackVerifiedResponse) => void) | null = null; let lastToken: RadarTrackVerifiedResponse | null = null; let lastTokenNow: number = 0; +let expectedCountryCode: string | null = null; +let expectedStateCode: string | null = null; class VerifyAPI { static async trackVerified(params: RadarTrackParams, encrypted: Boolean = false) { @@ -46,6 +48,8 @@ class VerifyAPI { stopped: true, userId, encrypted, + expectedCountryCode, + expectedStateCode, }; let userAgent = navigator.userAgent; @@ -151,6 +155,11 @@ class VerifyAPI { return this.trackVerified({}); } + static setExpectedJurisdiction(countryCode?: string, stateCode?: string) { + expectedCountryCode = countryCode; + expectedStateCode = stateCode; + } + static onTokenUpdated(callback: (token: RadarTrackVerifiedResponse) => void) { tokenCallback = callback; } diff --git a/src/index.ts b/src/index.ts index 57c615f..0260d86 100644 --- a/src/index.ts +++ b/src/index.ts @@ -162,6 +162,10 @@ class Radar { return VerifyAPI.getVerifiedLocationToken(); } + public static setExpectedJurisdiction(countryCode?: string, stateCode?: string) { + VerifyAPI.setExpectedJurisdiction(countryCode, stateCode); + } + public static getContext(params: Location) { return ContextAPI.getContext(params); }