radar-sdk-js 4.4.6-beta.0 → 4.4.6
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 +8 -8
- package/dist/logger.d.ts +1 -1
- package/dist/radar.js +6 -16
- package/dist/radar.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +12 -2
- package/src/api.ts +1 -1
- package/src/logger.ts +2 -2
- package/src/ui/RadarMap.ts +1 -12
- package/src/ui/autocomplete.ts +1 -1
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
|
|
31
31
|
### With npm
|
|
32
32
|
|
|
33
|
-
> **Note:** The Radar JS SDK has a peer
|
|
33
|
+
> **Note:** The Radar JS SDK has a peer dependency on [maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js).
|
|
34
34
|
|
|
35
35
|
Add the `radar-sdk-js` and `maplibre-gl` packages
|
|
36
36
|
```bash
|
|
@@ -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.4.6
|
|
59
|
+
<script src="https://js.radar.com/v4.4.6/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.4.6
|
|
77
|
-
<script src="https://js.radar.com/v4.4.6
|
|
76
|
+
<link href="https://js.radar.com/v4.4.6/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.4.6/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.4.6
|
|
102
|
-
<script src="https://js.radar.com/v4.4.6
|
|
101
|
+
<link href="https://js.radar.com/v4.4.6/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.4.6/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.4.6
|
|
134
|
-
<script src="https://js.radar.com/v4.4.6
|
|
133
|
+
<link href="https://js.radar.com/v4.4.6/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.4.6/radar.min.js"></script>
|
|
135
135
|
</head>
|
|
136
136
|
|
|
137
137
|
<body>
|
package/dist/logger.d.ts
CHANGED
package/dist/radar.js
CHANGED
|
@@ -42,9 +42,9 @@ const getLevel = () => {
|
|
|
42
42
|
return LOG_LEVELS.error; // default to error-level logging if not set
|
|
43
43
|
};
|
|
44
44
|
class Logger {
|
|
45
|
-
static debug(message) {
|
|
45
|
+
static debug(message, options) {
|
|
46
46
|
if (getLevel() === LOG_LEVELS.debug) {
|
|
47
|
-
console.log(`Radar SDK (debug): ${message.trim()}
|
|
47
|
+
console.log(`Radar SDK (debug): ${message.trim()}`, options);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
static info(message) {
|
|
@@ -405,7 +405,7 @@ class Navigator {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
var SDK_VERSION = '4.4.6
|
|
408
|
+
var SDK_VERSION = '4.4.6';
|
|
409
409
|
|
|
410
410
|
const inFlightRequests = new Map();
|
|
411
411
|
class Http {
|
|
@@ -1496,7 +1496,7 @@ let Radar$1 = class Radar {
|
|
|
1496
1496
|
Config.setup(radarOptions);
|
|
1497
1497
|
Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`);
|
|
1498
1498
|
if (options.debug) {
|
|
1499
|
-
Logger.
|
|
1499
|
+
Logger.debug('using options', options);
|
|
1500
1500
|
}
|
|
1501
1501
|
// NOTE(jasonl): this allows us to run jest tests
|
|
1502
1502
|
// without having to mock the ConfigAPI.getConfig call
|
|
@@ -2016,16 +2016,6 @@ const getStyle = (options, mapOptions) => {
|
|
|
2016
2016
|
}
|
|
2017
2017
|
return mapOptions.style; // style object or URL
|
|
2018
2018
|
};
|
|
2019
|
-
const logMapOptions = (options, mapOptions) => {
|
|
2020
|
-
if (options.debug) {
|
|
2021
|
-
const optionsCopy = structuredClone(mapOptions);
|
|
2022
|
-
if (typeof (optionsCopy === null || optionsCopy === void 0 ? void 0 : optionsCopy.container) !== 'string') {
|
|
2023
|
-
// BUGFIX: remove circular references when using react ref as container
|
|
2024
|
-
delete optionsCopy.container;
|
|
2025
|
-
}
|
|
2026
|
-
Logger.debug(`initialize map with options: ${JSON.stringify(optionsCopy)}`);
|
|
2027
|
-
}
|
|
2028
|
-
};
|
|
2029
2019
|
class RadarMap extends maplibregl.Map {
|
|
2030
2020
|
constructor(radarMapOptions) {
|
|
2031
2021
|
const config = Config.get();
|
|
@@ -2035,7 +2025,7 @@ class RadarMap extends maplibregl.Map {
|
|
|
2035
2025
|
// configure map options
|
|
2036
2026
|
const style = getStyle(config, radarMapOptions);
|
|
2037
2027
|
const mapOptions = Object.assign({}, defaultRadarMapOptions, defaultMaplibreOptions, radarMapOptions, { style });
|
|
2038
|
-
|
|
2028
|
+
Logger.debug('map initailized with options', mapOptions);
|
|
2039
2029
|
mapOptions.transformRequest = (url, resourceType) => {
|
|
2040
2030
|
// this handles when a style is switched
|
|
2041
2031
|
if (resourceType === 'Style' && isRadarStyle(url)) {
|
|
@@ -2539,7 +2529,7 @@ class AutocompleteUI {
|
|
|
2539
2529
|
if (this.config.hideResultsOnBlur) {
|
|
2540
2530
|
this.inputField.addEventListener('blur', this.close.bind(this), true);
|
|
2541
2531
|
}
|
|
2542
|
-
Logger.debug(
|
|
2532
|
+
Logger.debug('AutocompleteUI initialized with options', this.config);
|
|
2543
2533
|
}
|
|
2544
2534
|
handleInput() {
|
|
2545
2535
|
// Fetch autocomplete results and display them
|
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/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.4.6
|
|
1
|
+
declare const _default: "4.4.6";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "radar-sdk-js",
|
|
3
|
-
"version": "4.4.6
|
|
3
|
+
"version": "4.4.6",
|
|
4
4
|
"description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.",
|
|
5
5
|
"homepage": "https://radar.com",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"test": "jest --collect-coverage --runInBand",
|
|
24
24
|
"test:watch": "jest --watch",
|
|
25
25
|
"demo": "npm run build && node ./demo/server.cjs",
|
|
26
|
-
"compile-site": "node ./scripts/compile-site.cjs"
|
|
26
|
+
"compile-site": "node ./scripts/compile-site.cjs",
|
|
27
|
+
"spell-check": "cspell **/*.md -c cspell.json",
|
|
28
|
+
"prepare": "husky"
|
|
27
29
|
},
|
|
28
30
|
"author": "",
|
|
29
31
|
"license": "ISC",
|
|
@@ -33,11 +35,14 @@
|
|
|
33
35
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
34
36
|
"@rollup/plugin-terser": "^0.4.3",
|
|
35
37
|
"@types/jest": "^29.5.1",
|
|
38
|
+
"cspell": "^8.15.3",
|
|
36
39
|
"express": "^4.18.2",
|
|
37
40
|
"express-handlebars": "^7.0.7",
|
|
38
41
|
"handlebars": "^4.7.7",
|
|
42
|
+
"husky": "^9.1.6",
|
|
39
43
|
"jest": "^29.5.0",
|
|
40
44
|
"jest-environment-jsdom": "^29.5.0",
|
|
45
|
+
"lint-staged": "^15.2.10",
|
|
41
46
|
"maplibre-gl": "^4.3.2",
|
|
42
47
|
"mock-xmlhttprequest": "^8.2.0",
|
|
43
48
|
"nodemon": "^2.0.22",
|
|
@@ -53,5 +58,10 @@
|
|
|
53
58
|
},
|
|
54
59
|
"peerDependencies": {
|
|
55
60
|
"maplibre-gl": "^2.4.0 || ^3.0.0 || ^4.0.0"
|
|
61
|
+
},
|
|
62
|
+
"husky": {
|
|
63
|
+
"hooks": {
|
|
64
|
+
"pre-commit": "lint-staged"
|
|
65
|
+
}
|
|
56
66
|
}
|
|
57
67
|
}
|
package/src/api.ts
CHANGED
|
@@ -76,7 +76,7 @@ class Radar {
|
|
|
76
76
|
|
|
77
77
|
Logger.info(`initialized with ${live ? 'live' : 'test'} publishableKey.`);
|
|
78
78
|
if (options.debug) {
|
|
79
|
-
Logger.
|
|
79
|
+
Logger.debug('using options', options);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// NOTE(jasonl): this allows us to run jest tests
|
package/src/logger.ts
CHANGED
|
@@ -27,9 +27,9 @@ const getLevel = (): number => {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
class Logger {
|
|
30
|
-
public static debug(message: string) {
|
|
30
|
+
public static debug(message: string, options?: any) {
|
|
31
31
|
if (getLevel() === LOG_LEVELS.debug) {
|
|
32
|
-
console.log(`Radar SDK (debug): ${message.trim()}
|
|
32
|
+
console.log(`Radar SDK (debug): ${message.trim()}`, options);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
package/src/ui/RadarMap.ts
CHANGED
|
@@ -77,17 +77,6 @@ const getStyle = (options: RadarOptions, mapOptions: RadarMapOptions) => {
|
|
|
77
77
|
return mapOptions.style; // style object or URL
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const logMapOptions = (options: RadarOptions, mapOptions: RadarMapOptions) => {
|
|
81
|
-
if (options.debug) {
|
|
82
|
-
const optionsCopy: any = structuredClone(mapOptions);
|
|
83
|
-
if (typeof optionsCopy?.container !== 'string') {
|
|
84
|
-
// BUGFIX: remove circular references when using react ref as container
|
|
85
|
-
delete optionsCopy.container;
|
|
86
|
-
}
|
|
87
|
-
Logger.debug(`initialize map with options: ${JSON.stringify(optionsCopy)}`);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
80
|
class RadarMap extends maplibregl.Map {
|
|
92
81
|
_markers: RadarMarker[] = [];
|
|
93
82
|
_features: RadarMapFeature[] = [];
|
|
@@ -107,7 +96,7 @@ class RadarMap extends maplibregl.Map {
|
|
|
107
96
|
radarMapOptions,
|
|
108
97
|
{ style },
|
|
109
98
|
);
|
|
110
|
-
|
|
99
|
+
Logger.debug('map initailized with options', mapOptions);
|
|
111
100
|
|
|
112
101
|
(mapOptions as maplibregl.MapOptions).transformRequest = (url, resourceType) => {
|
|
113
102
|
// this handles when a style is switched
|
package/src/ui/autocomplete.ts
CHANGED
|
@@ -186,7 +186,7 @@ class AutocompleteUI {
|
|
|
186
186
|
this.inputField.addEventListener('blur', this.close.bind(this), true);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
Logger.debug(
|
|
189
|
+
Logger.debug('AutocompleteUI initialized with options', this.config);
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
public handleInput() {
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.4.6
|
|
1
|
+
export default '4.4.6';
|