radar-sdk-js 4.0.0-beta.21 → 4.0.0-beta.22

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 CHANGED
@@ -57,7 +57,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ });
57
57
 
58
58
  Add the following script in your `html` file
59
59
  ```html
60
- <script src="https://js.radar.com/v4.0.0-beta.21/radar.min.js"></script>
60
+ <script src="https://js.radar.com/v4.0.0-beta.22/radar.min.js"></script>
61
61
  ```
62
62
 
63
63
  Then initialize the Radar SDK
@@ -74,8 +74,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then
74
74
  ```html
75
75
  <html>
76
76
  <head>
77
- <link href="https://js.radar.com/v4.0.0-beta.21/radar.css" rel="stylesheet">
78
- <script src="https://js.radar.com/v4.0.0-beta.21/radar.min.js"></script>
77
+ <link href="https://js.radar.com/v4.0.0-beta.22/radar.css" rel="stylesheet">
78
+ <script src="https://js.radar.com/v4.0.0-beta.22/radar.min.js"></script>
79
79
  </head>
80
80
 
81
81
  <body>
@@ -99,8 +99,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis
99
99
  ```html
100
100
  <html>
101
101
  <head>
102
- <link href="https://js.radar.com/v4.0.0-beta.21/radar.css" rel="stylesheet">
103
- <script src="https://js.radar.com/v4.0.0-beta.21/radar.min.js"></script>
102
+ <link href="https://js.radar.com/v4.0.0-beta.22/radar.css" rel="stylesheet">
103
+ <script src="https://js.radar.com/v4.0.0-beta.22/radar.min.js"></script>
104
104
  </head>
105
105
 
106
106
  <body>
@@ -131,8 +131,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper
131
131
  ```html
132
132
  <html>
133
133
  <head>
134
- <link href="https://js.radar.com/v4.0.0-beta.21/radar.css" rel="stylesheet">
135
- <script src="https://js.radar.com/v4.0.0-beta.21/radar.min.js"></script>
134
+ <link href="https://js.radar.com/v4.0.0-beta.22/radar.css" rel="stylesheet">
135
+ <script src="https://js.radar.com/v4.0.0-beta.22/radar.min.js"></script>
136
136
  </head>
137
137
 
138
138
  <body>
package/dist/radar.js CHANGED
@@ -551,7 +551,7 @@ var Navigator = /** @class */ (function () {
551
551
  return Navigator;
552
552
  }());
553
553
 
554
- var SDK_VERSION = '4.0.0-beta.21';
554
+ var SDK_VERSION = '4.0.0-beta.22';
555
555
 
556
556
  var Http = /** @class */ (function () {
557
557
  function Http() {
@@ -1508,6 +1508,13 @@ var createStyleURL = function (options, style) {
1508
1508
  if (style === void 0) { style = DEFAULT_STYLE; }
1509
1509
  return ("".concat(options.host, "/maps/styles/").concat(style, "?publishableKey=").concat(options.publishableKey));
1510
1510
  };
1511
+ // use formatted style URL if using one of Radar's out-of-the-box styles
1512
+ var getStyle = function (options, mapOptions) {
1513
+ if (!mapOptions.style || mapOptions.style === DEFAULT_STYLE) {
1514
+ return createStyleURL(options, mapOptions.style);
1515
+ }
1516
+ return mapOptions.style;
1517
+ };
1511
1518
  var MapUI = /** @class */ (function () {
1512
1519
  function MapUI() {
1513
1520
  }
@@ -1516,16 +1523,12 @@ var MapUI = /** @class */ (function () {
1516
1523
  };
1517
1524
  MapUI.createMap = function (mapOptions) {
1518
1525
  var options = Config.get();
1519
- var style = mapOptions.style || DEFAULT_STYLE;
1520
- var radarStyleURL = createStyleURL(options, style);
1521
1526
  if (!options.publishableKey) {
1522
1527
  Logger.warn('publishableKey not set. Call Radar.initialize() with key before creating a new map.');
1523
1528
  }
1524
1529
  // configure maplibre options
1525
- var maplibreOptions = Object.assign({}, defaultMaplibreOptions, {
1526
- style: radarStyleURL,
1527
- container: mapOptions.container,
1528
- });
1530
+ var style = getStyle(options, mapOptions);
1531
+ var maplibreOptions = Object.assign({}, defaultMaplibreOptions, { style: style }, mapOptions);
1529
1532
  Logger.debug("initialize map with options: ".concat(JSON.stringify(maplibreOptions)));
1530
1533
  // set container
1531
1534
  maplibreOptions.container = mapOptions.container;
package/dist/radar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/types.d.ts CHANGED
@@ -331,9 +331,8 @@ export interface RadarSearchGeofencesParams {
331
331
  export interface RadarSearchGeofencesResponse extends RadarResponse {
332
332
  geofences: RadarGeofence[];
333
333
  }
334
- export interface RadarMapOptions {
334
+ export interface RadarMapOptions extends maplibregl.MapOptions {
335
335
  container: string | HTMLElement;
336
- style?: string;
337
336
  }
338
337
  export interface RadarMarkerOptions {
339
338
  color?: string;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "4.0.0-beta.21";
1
+ declare const _default: "4.0.0-beta.22";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radar-sdk-js",
3
- "version": "4.0.0-beta.21",
3
+ "version": "4.0.0-beta.22",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "module": "dist/radar.js",
package/src/types.ts CHANGED
@@ -444,9 +444,8 @@ export interface RadarSearchGeofencesResponse extends RadarResponse {
444
444
  geofences: RadarGeofence[];
445
445
  }
446
446
 
447
- export interface RadarMapOptions {
447
+ export interface RadarMapOptions extends maplibregl.MapOptions {
448
448
  container: string | HTMLElement;
449
- style?: string;
450
449
  }
451
450
 
452
451
  export interface RadarMarkerOptions {
package/src/ui/map.ts CHANGED
@@ -26,6 +26,14 @@ const createStyleURL = (options: RadarOptions, style: string = DEFAULT_STYLE) =>
26
26
  `${options.host}/maps/styles/${style}?publishableKey=${options.publishableKey}`
27
27
  );
28
28
 
29
+ // use formatted style URL if using one of Radar's out-of-the-box styles
30
+ const getStyle = (options: RadarOptions, mapOptions: RadarMapOptions) => {
31
+ if (!mapOptions.style || mapOptions.style === DEFAULT_STYLE) {
32
+ return createStyleURL(options, mapOptions.style);
33
+ }
34
+ return mapOptions.style;
35
+ };
36
+
29
37
  class MapUI {
30
38
  public static getMapLibre() {
31
39
  return maplibregl;
@@ -34,20 +42,16 @@ class MapUI {
34
42
  public static createMap(mapOptions: RadarMapOptions): maplibregl.Map {
35
43
  const options = Config.get();
36
44
 
37
- const style = mapOptions.style || DEFAULT_STYLE;
38
- const radarStyleURL = createStyleURL(options, style);
39
-
40
45
  if (!options.publishableKey) {
41
46
  Logger.warn('publishableKey not set. Call Radar.initialize() with key before creating a new map.');
42
47
  }
43
48
 
44
49
  // configure maplibre options
50
+ const style = getStyle(options, mapOptions);
45
51
  const maplibreOptions: maplibregl.MapOptions = Object.assign({},
46
52
  defaultMaplibreOptions,
47
- {
48
- style: radarStyleURL,
49
- container: mapOptions.container,
50
- },
53
+ { style },
54
+ mapOptions,
51
55
  );
52
56
  Logger.debug(`initialize map with options: ${JSON.stringify(maplibreOptions)}`);
53
57
 
@@ -69,7 +73,6 @@ class MapUI {
69
73
  link.appendChild(img)
70
74
  map.getContainer().appendChild(link);
71
75
 
72
-
73
76
  // add zoom controls
74
77
  const nav = new maplibregl.NavigationControl({ showCompass: false });
75
78
  map.addControl(nav, 'bottom-right');
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '4.0.0-beta.21';
1
+ export default '4.0.0-beta.22';