From 1f2d176e0255d3e017767cd5db9651e258284350 Mon Sep 17 00:00:00 2001 From: Nick Patrick Date: Mon, 12 Aug 2024 07:03:30 -0400 Subject: [PATCH] add setExpectedJurisdiction() --- src/api/verify.ts | 9 +++++++++ src/index.ts | 4 ++++ 2 files changed, 13 insertions(+) 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); }