Skip to content

Commit

Permalink
expose fields for trackOnce({ fraud: true })
Browse files Browse the repository at this point in the history
  • Loading branch information
nickpatrick committed Aug 12, 2024
1 parent f4bb957 commit 944e5e8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/api/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,10 @@ class TrackAPI {
};
}

let { user, events, token, expiresAt } = response;
let { user, events, token, expiresAt, expiresIn, passed, failureReasons, _id } = response;
const location = { latitude, longitude, accuracy };
let passed;
let expiresIn;
if (expiresAt) {
expiresAt = new Date(expiresAt);
passed = user?.fraud?.passed && user?.country?.passed && user?.state?.passed;
expiresIn = (expiresAt.getTime() - Date.now()) / 1000;
}

const trackRes = {
Expand All @@ -180,6 +176,8 @@ class TrackAPI {
expiresAt,
expiresIn,
passed,
failureReasons,
_id,
} as RadarTrackVerifiedResponse;

if (options.debug) {
Expand Down

0 comments on commit 944e5e8

Please sign in to comment.