diff --git a/README.md b/README.md index e0698587..0bf3e524 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 6f2b7bf3..84c931ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "radar-sdk-js", - "version": "4.4.10", + "version": "4.4.11-beta.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "radar-sdk-js", - "version": "4.4.10", + "version": "4.4.11-beta.0", "license": "ISC", "dependencies": { - "@types/geojson": "^7946.0.10" + "@types/geojson": "^7946.0.10", + "detectincognitojs": "^1.3.7" }, "devDependencies": { "@rollup/plugin-commonjs": "^25.0.2", @@ -3477,6 +3478,12 @@ "node": ">=8" } }, + "node_modules/detectincognitojs": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/detectincognitojs/-/detectincognitojs-1.3.7.tgz", + "integrity": "sha512-8Z90m1utiUMr0hz0eYqg1x0P5uM6hSqGe0TdLtZGunDEptoaoYmcWKbk2qmAezilErNbY9hmqcdNIYooUc925w==", + "license": "MIT" + }, "node_modules/diff-sequences": { "version": "29.4.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", diff --git a/package.json b/package.json index df56c923..aa1ef598 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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" diff --git a/src/api/track.ts b/src/api/track.ts index 5add1e7e..6e615776 100644 --- a/src/api/track.ts +++ b/src/api/track.ts @@ -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'; @@ -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, @@ -84,6 +95,7 @@ class TrackAPI { userId, tripOptions, timeZone, + incognito, }; let response: any; diff --git a/src/version.ts b/src/version.ts index 6fa3ea42..41edcf08 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '4.4.10'; \ No newline at end of file +export default '4.4.11-beta.0'; \ No newline at end of file