Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });

Add the following script in your `html` file
```html
<script src="https://js.radar.com/v4.4.10/radar.min.js"></script>
<script src="https://js.radar.com/v4.4.11-beta.0/radar.min.js"></script>
```

Then initialize the Radar SDK
Expand All @@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
```html
<html>
<head>
<link href="https://js.radar.com/v4.4.10/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.10/radar.min.js"></script>
<link href="https://js.radar.com/v4.4.11-beta.0/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.11-beta.0/radar.min.js"></script>
</head>

<body>
Expand All @@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
```html
<html>
<head>
<link href="https://js.radar.com/v4.4.10/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.10/radar.min.js"></script>
<link href="https://js.radar.com/v4.4.11-beta.0/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.11-beta.0/radar.min.js"></script>
</head>

<body>
Expand Down Expand Up @@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
```html
<html>
<head>
<link href="https://js.radar.com/v4.4.10/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.10/radar.min.js"></script>
<link href="https://js.radar.com/v4.4.11-beta.0/radar.css" rel="stylesheet">
<script src="https://js.radar.com/v4.4.11-beta.0/radar.min.js"></script>
</head>

<body>
Expand Down
13 changes: 10 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "radar-sdk-js",
"version": "4.4.10",
"version": "4.4.11-beta.0",
"description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.",
"homepage": "https://radar.com",
"type": "module",
Expand Down Expand Up @@ -54,7 +54,8 @@
"typescript": "^5.0.4"
},
"dependencies": {
"@types/geojson": "^7946.0.10"
"@types/geojson": "^7946.0.10",
"detectincognitojs": "^1.3.7"
},
"peerDependencies": {
"maplibre-gl": "^2.4.0 || ^3.0.0 || ^4.0.0"
Expand Down
14 changes: 13 additions & 1 deletion src/api/track.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Session from '../session';
import Storage from '../storage';
import TripsAPI from './trips';
import { signJWT } from '../util/jwt';
import { ping } from '../util/net';
import { detectIncognito } from "detectincognitojs";

import type { RadarTrackParams, RadarTrackResponse, RadarTrackVerifiedResponse } from '../types';

Expand Down Expand Up @@ -66,6 +66,17 @@ class TrackAPI {
tripOptions.version = '2';
}

let incognito = false;
if (fraud) {
try {
const result = await detectIncognito();
incognito = result.isPrivate;
} catch (err: any) {
Logger.warn(`Error detecting incognito mode: ${err.message}`);
incognito = true;
}
}

const body = {
...params,
locationAuthorization,
Expand All @@ -84,6 +95,7 @@ class TrackAPI {
userId,
tripOptions,
timeZone,
incognito,
};

let response: any;
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export default '4.4.10';
export default '4.4.11-beta.0';
Loading