radar-sdk-js 4.3.0-beta.0 → 4.3.0-beta.2
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/radar.js +10 -8
- package/dist/radar.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/ui/RadarMap.d.ts +0 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/types.ts +1 -1
- package/src/ui/RadarMap.ts +10 -10
- 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.3.0-beta.
|
|
59
|
+
<script src="https://js.radar.com/v4.3.0-beta.2/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.3.0-beta.
|
|
77
|
-
<script src="https://js.radar.com/v4.3.0-beta.
|
|
76
|
+
<link href="https://js.radar.com/v4.3.0-beta.2/radar.css" rel="stylesheet">
|
|
77
|
+
<script src="https://js.radar.com/v4.3.0-beta.2/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.3.0-beta.
|
|
102
|
-
<script src="https://js.radar.com/v4.3.0-beta.
|
|
101
|
+
<link href="https://js.radar.com/v4.3.0-beta.2/radar.css" rel="stylesheet">
|
|
102
|
+
<script src="https://js.radar.com/v4.3.0-beta.2/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.3.0-beta.
|
|
134
|
-
<script src="https://js.radar.com/v4.3.0-beta.
|
|
133
|
+
<link href="https://js.radar.com/v4.3.0-beta.2/radar.css" rel="stylesheet">
|
|
134
|
+
<script src="https://js.radar.com/v4.3.0-beta.2/radar.min.js"></script>
|
|
135
135
|
</head>
|
|
136
136
|
|
|
137
137
|
<body>
|
package/dist/radar.js
CHANGED
|
@@ -405,7 +405,7 @@ class Navigator {
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
-
var SDK_VERSION = '4.3.0-beta.
|
|
408
|
+
var SDK_VERSION = '4.3.0-beta.2';
|
|
409
409
|
|
|
410
410
|
class Http {
|
|
411
411
|
static request({ method, path, data, host, version, headers = {}, responseType, }) {
|
|
@@ -1445,7 +1445,6 @@ class RadarLogoControl {
|
|
|
1445
1445
|
}
|
|
1446
1446
|
}
|
|
1447
1447
|
|
|
1448
|
-
const DEFAULT_STYLE = 'radar-default-v1';
|
|
1449
1448
|
const RADAR_STYLES = [
|
|
1450
1449
|
'radar-default-v1',
|
|
1451
1450
|
'radar-light-v1',
|
|
@@ -1459,7 +1458,13 @@ const defaultMaplibreOptions = {
|
|
|
1459
1458
|
touchPitch: false,
|
|
1460
1459
|
maplibreLogo: false,
|
|
1461
1460
|
};
|
|
1462
|
-
const createStyleURL = (options,
|
|
1461
|
+
const createStyleURL = (options, mapOptions) => {
|
|
1462
|
+
let url = `${options.host}/maps/styles/${mapOptions.style}?publishableKey=${options.publishableKey}`;
|
|
1463
|
+
if (mapOptions.locale) {
|
|
1464
|
+
url += `&locale=${mapOptions.locale}`;
|
|
1465
|
+
}
|
|
1466
|
+
return url;
|
|
1467
|
+
};
|
|
1463
1468
|
// check if style is a Radar style or a custom style
|
|
1464
1469
|
const isRadarStyle = (style) => {
|
|
1465
1470
|
if (RADAR_STYLES.includes(style)) { // Radar built-in style
|
|
@@ -1474,7 +1479,7 @@ const isRadarStyle = (style) => {
|
|
|
1474
1479
|
const getStyle = (options, mapOptions) => {
|
|
1475
1480
|
const style = mapOptions.style;
|
|
1476
1481
|
if (!style || (typeof style === 'string' && isRadarStyle(style))) {
|
|
1477
|
-
return createStyleURL(options,
|
|
1482
|
+
return createStyleURL(options, mapOptions);
|
|
1478
1483
|
}
|
|
1479
1484
|
return mapOptions.style; // style object or URL
|
|
1480
1485
|
};
|
|
@@ -1488,10 +1493,7 @@ class RadarMap extends maplibregl.Map {
|
|
|
1488
1493
|
const style = getStyle(config, mapOptions);
|
|
1489
1494
|
const maplibreOptions = Object.assign({}, defaultMaplibreOptions, mapOptions, { style });
|
|
1490
1495
|
Logger.debug(`initialize map with options: ${JSON.stringify(maplibreOptions)}`);
|
|
1491
|
-
maplibreOptions.transformRequest = (url
|
|
1492
|
-
if (resourceType === 'Style' && isRadarStyle(url)) {
|
|
1493
|
-
url = createStyleURL(config, url);
|
|
1494
|
-
}
|
|
1496
|
+
maplibreOptions.transformRequest = (url) => {
|
|
1495
1497
|
let headers = {
|
|
1496
1498
|
'Authorization': config.publishableKey,
|
|
1497
1499
|
'X-Radar-Device-Type': 'Web',
|
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
|
@@ -345,7 +345,7 @@ export interface RadarSearchGeofencesResponse extends RadarResponse {
|
|
|
345
345
|
geofences: RadarGeofence[];
|
|
346
346
|
}
|
|
347
347
|
export interface RadarMapOptions extends Omit<maplibregl.MapOptions, 'transformRequest'> {
|
|
348
|
-
|
|
348
|
+
locale?: string;
|
|
349
349
|
}
|
|
350
350
|
export interface RadarMarkerImage {
|
|
351
351
|
url?: string;
|
package/dist/ui/RadarMap.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import maplibregl from 'maplibre-gl';
|
|
|
2
2
|
import RadarMarker from './RadarMarker';
|
|
3
3
|
import type { RadarMapOptions } from '../types';
|
|
4
4
|
declare class RadarMap extends maplibregl.Map {
|
|
5
|
-
_customMarkerRawSvg: string | undefined;
|
|
6
5
|
_markers: RadarMarker[];
|
|
7
6
|
constructor(mapOptions: RadarMapOptions);
|
|
8
7
|
addMarker(marker: RadarMarker): void;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "4.3.0-beta.
|
|
1
|
+
declare const _default: "4.3.0-beta.2";
|
|
2
2
|
export default _default;
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -460,7 +460,7 @@ export interface RadarSearchGeofencesResponse extends RadarResponse {
|
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
export interface RadarMapOptions extends Omit<maplibregl.MapOptions, 'transformRequest'> {
|
|
463
|
-
|
|
463
|
+
locale?: string;
|
|
464
464
|
}
|
|
465
465
|
|
|
466
466
|
export interface RadarMarkerImage {
|
package/src/ui/RadarMap.ts
CHANGED
|
@@ -26,9 +26,13 @@ const defaultMaplibreOptions: Partial<maplibregl.MapOptions> = {
|
|
|
26
26
|
maplibreLogo: false,
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
const createStyleURL = (options: RadarOptions,
|
|
30
|
-
`${options.host}/maps/styles/${style}?publishableKey=${options.publishableKey}`
|
|
31
|
-
)
|
|
29
|
+
const createStyleURL = (options: RadarOptions, mapOptions: RadarMapOptions) => {
|
|
30
|
+
let url = `${options.host}/maps/styles/${mapOptions.style}?publishableKey=${options.publishableKey}`
|
|
31
|
+
if (mapOptions.locale) {
|
|
32
|
+
url += `&locale=${mapOptions.locale}`
|
|
33
|
+
}
|
|
34
|
+
return url
|
|
35
|
+
};
|
|
32
36
|
|
|
33
37
|
// check if style is a Radar style or a custom style
|
|
34
38
|
const isRadarStyle = (style: string) => {
|
|
@@ -46,14 +50,13 @@ const getStyle = (options: RadarOptions, mapOptions: RadarMapOptions) => {
|
|
|
46
50
|
const style = mapOptions.style;
|
|
47
51
|
|
|
48
52
|
if (!style || (typeof style === 'string' && isRadarStyle(style))) {
|
|
49
|
-
return createStyleURL(options,
|
|
53
|
+
return createStyleURL(options, mapOptions);
|
|
50
54
|
}
|
|
51
55
|
|
|
52
56
|
return mapOptions.style; // style object or URL
|
|
53
57
|
};
|
|
54
58
|
|
|
55
59
|
class RadarMap extends maplibregl.Map {
|
|
56
|
-
_customMarkerRawSvg: string | undefined;
|
|
57
60
|
_markers: RadarMarker[] = [];
|
|
58
61
|
|
|
59
62
|
constructor(mapOptions: RadarMapOptions) {
|
|
@@ -65,17 +68,14 @@ class RadarMap extends maplibregl.Map {
|
|
|
65
68
|
|
|
66
69
|
// configure maplibre options
|
|
67
70
|
const style = getStyle(config, mapOptions);
|
|
68
|
-
const maplibreOptions:
|
|
71
|
+
const maplibreOptions: RadarMapOptions = Object.assign({},
|
|
69
72
|
defaultMaplibreOptions,
|
|
70
73
|
mapOptions,
|
|
71
74
|
{ style },
|
|
72
75
|
);
|
|
73
76
|
Logger.debug(`initialize map with options: ${JSON.stringify(maplibreOptions)}`);
|
|
74
77
|
|
|
75
|
-
maplibreOptions.transformRequest = (url
|
|
76
|
-
if (resourceType === 'Style' && isRadarStyle(url)) {
|
|
77
|
-
url = createStyleURL(config, url);
|
|
78
|
-
}
|
|
78
|
+
(maplibreOptions as maplibregl.MapOptions).transformRequest = (url) => {
|
|
79
79
|
|
|
80
80
|
let headers = {
|
|
81
81
|
'Authorization': config.publishableKey,
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '4.3.0-beta.
|
|
1
|
+
export default '4.3.0-beta.2';
|