diff --git a/README.md b/README.md index 2b2757ea..cdde567d 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ }); Add the following script in your `html` file ```html - + ``` Then initialize the Radar SDK @@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then ```html
- - + + @@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis ```html - - + + @@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper ```html - - + + diff --git a/package-lock.json b/package-lock.json index 90a1df79..d7865f5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.2.0", + "version": "4.2.1", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 21813e9c..71454c9a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.2.0", + "version": "4.2.1", "description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.", "homepage": "https://radar.com", "type": "module", diff --git a/src/api/track.ts b/src/api/track.ts index 083800dd..c80cfb18 100644 --- a/src/api/track.ts +++ b/src/api/track.ts @@ -137,14 +137,14 @@ class TrackAPI { }), }; - const token = await signJWT(payload, dk); + const reqToken = await signJWT(payload, dk); response = await Http.request({ host, method: 'POST', path: 'track', data: { - token, + token: reqToken, }, headers: { 'X-Radar-Body-Is-Token': 'true', @@ -160,33 +160,33 @@ class TrackAPI { sclVal, cslVal, }; + } - let { user, events, token, expiresAt } = 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 = { - user, - events, - location, - token, - expiresAt, - expiresIn, - passed, - } as RadarTrackVerifiedResponse; - - if (options.debug) { - trackRes.response = response; - } + let { user, events, token, expiresAt } = 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; + } - return trackRes; + const trackRes = { + user, + events, + location, + token, + expiresAt, + expiresIn, + passed, + } as RadarTrackVerifiedResponse; + + if (options.debug) { + trackRes.response = response; } + + return trackRes; } response = await Http.request({ diff --git a/src/version.ts b/src/version.ts index 5897a092..7f14bcdc 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '4.2.0'; +export default '4.2.1';