radar-sdk-js 4.5.8-beta.0 → 4.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/navigator.d.ts +1 -1
- package/dist/radar.js +7 -22
- package/dist/radar.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/track.ts +1 -1
- package/src/api/verify.ts +2 -1
- package/src/navigator.ts +3 -25
- package/src/types.ts +1 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });
|
|
|
56
56
|
|
|
57
57
|
Add the following script in your `html` file
|
|
58
58
|
```html
|
|
59
|
-
<script src="https://js.radar.com/v4.5.8
|
|
59
|
+
<script src="https://js.radar.com/v4.5.8/radar.min.js"></script>
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
Then initialize the Radar SDK
|
|
@@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
|
|
|
73
73
|
```html
|
|
74
74
|
<html>
|
|
75
75
|
<head>
|
|
76
|
-
<link href="https://js.radar.com/v4.5.8
|
|
77
|
-
<script src="https://js.radar.com/v4.5.8
|
|
76
|
+
<link href="https://js.radar.com/v4.5.8/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.5.8/radar.min.js"></script>
|
|
78
78
|
</head>
|
|
79
79
|
|
|
80
80
|
<body>
|
|
@@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
|
|
|
98
98
|
```html
|
|
99
99
|
<html>
|
|
100
100
|
<head>
|
|
101
|
-
<link href="https://js.radar.com/v4.5.8
|
|
102
|
-
<script src="https://js.radar.com/v4.5.8
|
|
101
|
+
<link href="https://js.radar.com/v4.5.8/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.5.8/radar.min.js"></script>
|
|
103
103
|
</head>
|
|
104
104
|
|
|
105
105
|
<body>
|
|
@@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
|
|
|
130
130
|
```html
|
|
131
131
|
<html>
|
|
132
132
|
<head>
|
|
133
|
-
<link href="https://js.radar.com/v4.5.8
|
|
134
|
-
<script src="https://js.radar.com/v4.5.8
|
|
133
|
+
<link href="https://js.radar.com/v4.5.8/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.5.8/radar.min.js"></script>
|
|
135
135
|
</head>
|
|
136
136
|
|
|
137
137
|
<body>
|
package/dist/navigator.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ interface PositionOptionOverrides {
|
|
|
3
3
|
desiredAccuracy?: string;
|
|
4
4
|
}
|
|
5
5
|
declare class Navigator {
|
|
6
|
-
static getCurrentPosition(overrides?: PositionOptionOverrides
|
|
6
|
+
static getCurrentPosition(overrides?: PositionOptionOverrides): Promise<NavigatorPosition>;
|
|
7
7
|
static getPermissionStatus(): Promise<LocationAuthorization>;
|
|
8
8
|
static online(): Boolean;
|
|
9
9
|
}
|
package/dist/radar.js
CHANGED
|
@@ -316,21 +316,6 @@ class RadarAutocompleteContainerNotFound extends RadarError {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
const radarGeolocation = (() => {
|
|
320
|
-
if (!navigator) {
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
const g = navigator.geolocation;
|
|
324
|
-
if (!g) {
|
|
325
|
-
return null;
|
|
326
|
-
}
|
|
327
|
-
const emptyFn = () => { };
|
|
328
|
-
return Object.freeze({
|
|
329
|
-
getCurrentPosition: g.getCurrentPosition ? g.getCurrentPosition.bind(g) : emptyFn,
|
|
330
|
-
watchPosition: g.watchPosition ? g.watchPosition.bind(g) : emptyFn,
|
|
331
|
-
clearWatch: g.clearWatch ? g.clearWatch.bind(g) : emptyFn,
|
|
332
|
-
});
|
|
333
|
-
})();
|
|
334
319
|
const DEFAULT_POSITION_OPTIONS = {
|
|
335
320
|
maximumAge: 0,
|
|
336
321
|
timeout: 1000 * 10,
|
|
@@ -339,12 +324,11 @@ const DEFAULT_POSITION_OPTIONS = {
|
|
|
339
324
|
// set "enableHighAccuracy" for navigator only when desiredAccuracy is "high"
|
|
340
325
|
const useHighAccuracy = (desiredAccuracy) => (Boolean(desiredAccuracy === 'high'));
|
|
341
326
|
class Navigator {
|
|
342
|
-
static getCurrentPosition(overrides = {}
|
|
327
|
+
static getCurrentPosition(overrides = {}) {
|
|
343
328
|
return __awaiter(this, void 0, void 0, function* () {
|
|
344
329
|
return new Promise((resolve, reject) => {
|
|
345
330
|
const options = Config.get();
|
|
346
|
-
|
|
347
|
-
if (!g) {
|
|
331
|
+
if (!navigator || !navigator.geolocation) {
|
|
348
332
|
return reject(new RadarLocationError('navigator.geolocation is not available.'));
|
|
349
333
|
}
|
|
350
334
|
// use cached location if available and options are set
|
|
@@ -382,7 +366,7 @@ class Navigator {
|
|
|
382
366
|
}
|
|
383
367
|
Logger.info(`Using geolocation options: ${JSON.stringify(positionOptions)}`);
|
|
384
368
|
// get current location from browser
|
|
385
|
-
|
|
369
|
+
navigator.geolocation.getCurrentPosition((position) => {
|
|
386
370
|
if (!position || !position.coords) {
|
|
387
371
|
return reject(new RadarLocationError('device location return empty coordinates.'));
|
|
388
372
|
}
|
|
@@ -437,7 +421,7 @@ class Navigator {
|
|
|
437
421
|
}
|
|
438
422
|
}
|
|
439
423
|
|
|
440
|
-
var SDK_VERSION = '4.5.8
|
|
424
|
+
var SDK_VERSION = '4.5.8';
|
|
441
425
|
|
|
442
426
|
const inFlightRequests = new Map();
|
|
443
427
|
class Http {
|
|
@@ -1220,7 +1204,7 @@ class TrackAPI {
|
|
|
1220
1204
|
// if latitude & longitude are not provided,
|
|
1221
1205
|
// try and retrieve device location (will prompt for location permissions)
|
|
1222
1206
|
if (!latitude || !longitude) {
|
|
1223
|
-
const deviceLocation = yield Navigator.getCurrentPosition({ desiredAccuracy }
|
|
1207
|
+
const deviceLocation = yield Navigator.getCurrentPosition({ desiredAccuracy });
|
|
1224
1208
|
latitude = deviceLocation.latitude;
|
|
1225
1209
|
longitude = deviceLocation.longitude;
|
|
1226
1210
|
accuracy = deviceLocation.accuracy;
|
|
@@ -1382,7 +1366,7 @@ class VerifyAPI {
|
|
|
1382
1366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1383
1367
|
try {
|
|
1384
1368
|
const options = Config.get();
|
|
1385
|
-
const { skipVerifyApp } = params;
|
|
1369
|
+
const { skipVerifyApp, reason } = params;
|
|
1386
1370
|
// user indentification fields
|
|
1387
1371
|
const userId = params.userId || Storage.getItem(Storage.USER_ID);
|
|
1388
1372
|
const deviceId = Device.getDeviceId();
|
|
@@ -1405,6 +1389,7 @@ class VerifyAPI {
|
|
|
1405
1389
|
description: description !== null && description !== void 0 ? description : undefined,
|
|
1406
1390
|
metadata: metadata,
|
|
1407
1391
|
fraud: true,
|
|
1392
|
+
reason,
|
|
1408
1393
|
});
|
|
1409
1394
|
}
|
|
1410
1395
|
else {
|
package/dist/radar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.5.8
|
|
1
|
+
declare const _default: "4.5.8";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
package/src/api/track.ts
CHANGED
|
@@ -25,7 +25,7 @@ class TrackAPI {
|
|
|
25
25
|
// if latitude & longitude are not provided,
|
|
26
26
|
// try and retrieve device location (will prompt for location permissions)
|
|
27
27
|
if (!latitude || !longitude) {
|
|
28
|
-
const deviceLocation = await Navigator.getCurrentPosition({ desiredAccuracy }
|
|
28
|
+
const deviceLocation = await Navigator.getCurrentPosition({ desiredAccuracy });
|
|
29
29
|
latitude = deviceLocation.latitude;
|
|
30
30
|
longitude = deviceLocation.longitude;
|
|
31
31
|
accuracy = deviceLocation.accuracy;
|
package/src/api/verify.ts
CHANGED
|
@@ -48,7 +48,7 @@ class VerifyAPI {
|
|
|
48
48
|
try {
|
|
49
49
|
const options = Config.get();
|
|
50
50
|
|
|
51
|
-
const { skipVerifyApp } = params;
|
|
51
|
+
const { skipVerifyApp, reason } = params;
|
|
52
52
|
|
|
53
53
|
// user indentification fields
|
|
54
54
|
const userId = params.userId || Storage.getItem(Storage.USER_ID);
|
|
@@ -74,6 +74,7 @@ class VerifyAPI {
|
|
|
74
74
|
description: description ?? undefined,
|
|
75
75
|
metadata: metadata,
|
|
76
76
|
fraud: true,
|
|
77
|
+
reason,
|
|
77
78
|
});
|
|
78
79
|
} else {
|
|
79
80
|
const body = {
|
package/src/navigator.ts
CHANGED
|
@@ -5,26 +5,6 @@ import { RadarLocationError, RadarPermissionsError } from './errors';
|
|
|
5
5
|
|
|
6
6
|
import type { LocationAuthorization, NavigatorPosition } from './types';
|
|
7
7
|
|
|
8
|
-
const radarGeolocation = (() => {
|
|
9
|
-
if (!navigator) {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const g = navigator.geolocation;
|
|
14
|
-
|
|
15
|
-
if (!g) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const emptyFn = () => {};
|
|
20
|
-
|
|
21
|
-
return Object.freeze({
|
|
22
|
-
getCurrentPosition: g.getCurrentPosition ? g.getCurrentPosition.bind(g) : emptyFn,
|
|
23
|
-
watchPosition: g.watchPosition ? g.watchPosition.bind(g) : emptyFn,
|
|
24
|
-
clearWatch: g.clearWatch ? g.clearWatch.bind(g) : emptyFn,
|
|
25
|
-
});
|
|
26
|
-
})();
|
|
27
|
-
|
|
28
8
|
interface PositionOptionOverrides {
|
|
29
9
|
desiredAccuracy?: string;
|
|
30
10
|
}
|
|
@@ -41,13 +21,11 @@ const useHighAccuracy = (desiredAccuracy?: string) => (
|
|
|
41
21
|
);
|
|
42
22
|
|
|
43
23
|
class Navigator {
|
|
44
|
-
public static async getCurrentPosition(overrides: PositionOptionOverrides = {}
|
|
24
|
+
public static async getCurrentPosition(overrides: PositionOptionOverrides = {}): Promise<NavigatorPosition> {
|
|
45
25
|
return new Promise((resolve, reject) => {
|
|
46
26
|
const options = Config.get();
|
|
47
27
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (!g) {
|
|
28
|
+
if (!navigator || !navigator.geolocation) {
|
|
51
29
|
return reject(new RadarLocationError('navigator.geolocation is not available.'));
|
|
52
30
|
}
|
|
53
31
|
|
|
@@ -89,7 +67,7 @@ class Navigator {
|
|
|
89
67
|
Logger.info(`Using geolocation options: ${JSON.stringify(positionOptions)}`);
|
|
90
68
|
|
|
91
69
|
// get current location from browser
|
|
92
|
-
|
|
70
|
+
navigator.geolocation.getCurrentPosition(
|
|
93
71
|
(position) => {
|
|
94
72
|
if (!position || !position.coords) {
|
|
95
73
|
return reject(new RadarLocationError('device location return empty coordinates.'));
|
package/src/types.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.5.8
|
|
1
|
+
export default '4.5.8';
|