radar-sdk-js 4.2.0-beta.1 → 4.2.0-beta.4

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
@@ -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.2.0-beta.1/radar.min.js"></script>
59
+ <script src="https://js.radar.com/v4.2.0-beta.4/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.2.0-beta.1/radar.css" rel="stylesheet">
77
- <script src="https://js.radar.com/v4.2.0-beta.1/radar.min.js"></script>
76
+ <link href="https://js.radar.com/v4.2.0-beta.4/radar.css" rel="stylesheet">
77
+ <script src="https://js.radar.com/v4.2.0-beta.4/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.2.0-beta.1/radar.css" rel="stylesheet">
102
- <script src="https://js.radar.com/v4.2.0-beta.1/radar.min.js"></script>
101
+ <link href="https://js.radar.com/v4.2.0-beta.4/radar.css" rel="stylesheet">
102
+ <script src="https://js.radar.com/v4.2.0-beta.4/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.2.0-beta.1/radar.css" rel="stylesheet">
134
- <script src="https://js.radar.com/v4.2.0-beta.1/radar.min.js"></script>
133
+ <link href="https://js.radar.com/v4.2.0-beta.4/radar.css" rel="stylesheet">
134
+ <script src="https://js.radar.com/v4.2.0-beta.4/radar.min.js"></script>
135
135
  </head>
136
136
 
137
137
  <body>
package/dist/radar.js CHANGED
@@ -409,7 +409,7 @@ class Navigator {
409
409
  }
410
410
  }
411
411
 
412
- var SDK_VERSION = '4.2.0-beta.1';
412
+ var SDK_VERSION = '4.2.0-beta.4';
413
413
 
414
414
  class Http {
415
415
  static request({ method, path, data, host, versioned = true, headers = {}, }) {
@@ -1532,13 +1532,17 @@ class RadarMap extends maplibregl.Map {
1532
1532
  // custom request handler for Radar styles
1533
1533
  maplibreOptions.transformRequest = (url, resourceType) => {
1534
1534
  let radarStyleURL = url;
1535
+ let headers = { 'Authorization': config.publishableKey };
1535
1536
  if (resourceType === 'Style' && isRadarStyle(url)) {
1536
1537
  radarStyleURL = createStyleURL(config, url);
1537
1538
  }
1538
1539
  if (mapOptions.transformRequest) {
1539
1540
  return mapOptions.transformRequest(radarStyleURL, resourceType);
1540
1541
  }
1541
- return { url: radarStyleURL };
1542
+ if (typeof config.getRequestHeaders === 'function') {
1543
+ headers = Object.assign(headers, config.getRequestHeaders());
1544
+ }
1545
+ return { url: radarStyleURL, headers };
1542
1546
  };
1543
1547
  super(maplibreOptions);
1544
1548
  this._markers = [];
@@ -1571,17 +1575,18 @@ class RadarMap extends maplibregl.Map {
1571
1575
  this.on('resize', onResize);
1572
1576
  this.on('load', onResize);
1573
1577
  const onStyleLoad = () => __awaiter(this, void 0, void 0, function* () {
1574
- var _a;
1578
+ var _a, _b;
1575
1579
  this._customMarkerRawSvg = undefined;
1576
1580
  const style = this.getStyle();
1577
1581
  const customMarkers = (_a = style.metadata) === null || _a === void 0 ? void 0 : _a['radar:customMarkers'];
1578
- if (Array.isArray(customMarkers) && customMarkers.length > 0) {
1582
+ const radarCustomStyleId = (_b = style.metadata) === null || _b === void 0 ? void 0 : _b['radar:styleId'];
1583
+ if (radarCustomStyleId && Array.isArray(customMarkers) && customMarkers.length > 0) {
1579
1584
  const customMarker = customMarkers[0]; // only support one custom marker for now
1580
1585
  try {
1581
1586
  const markerRawSvg = yield Http.request({
1582
1587
  method: 'GET',
1583
1588
  versioned: false,
1584
- path: `maps/markers/${customMarker.id}`,
1589
+ path: `maps/${radarCustomStyleId}/markers/${customMarker.id}`,
1585
1590
  headers: {
1586
1591
  'Content-Type': 'image/svg+xml',
1587
1592
  },
package/dist/radar.js.map CHANGED
@@ -1 +1 @@
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.2.0-beta.1";
1
+ declare const _default: "4.2.0-beta.4";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radar-sdk-js",
3
- "version": "4.2.0-beta.1",
3
+ "version": "4.2.0-beta.4",
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",
@@ -71,6 +71,7 @@ class RadarMap extends maplibregl.Map {
71
71
  // custom request handler for Radar styles
72
72
  maplibreOptions.transformRequest = (url, resourceType) => {
73
73
  let radarStyleURL = url;
74
+ let headers = { 'Authorization': config.publishableKey };
74
75
  if (resourceType === 'Style' && isRadarStyle(url)) {
75
76
  radarStyleURL = createStyleURL(config, url);
76
77
  }
@@ -79,7 +80,11 @@ class RadarMap extends maplibregl.Map {
79
80
  return mapOptions.transformRequest(radarStyleURL, resourceType);
80
81
  }
81
82
 
82
- return { url: radarStyleURL };
83
+ if (typeof config.getRequestHeaders === 'function') {
84
+ headers = Object.assign(headers, config.getRequestHeaders());
85
+ }
86
+
87
+ return { url: radarStyleURL, headers };
83
88
  };
84
89
 
85
90
  super(maplibreOptions);
@@ -122,13 +127,14 @@ class RadarMap extends maplibregl.Map {
122
127
  const style = this.getStyle();
123
128
 
124
129
  const customMarkers = (style.metadata as any)?.['radar:customMarkers'];
125
- if (Array.isArray(customMarkers) && customMarkers.length > 0) {
130
+ const radarCustomStyleId = (style.metadata as any)?.['radar:styleId'];
131
+ if (radarCustomStyleId && Array.isArray(customMarkers) && customMarkers.length > 0) {
126
132
  const customMarker = customMarkers[0]; // only support one custom marker for now
127
133
  try {
128
134
  const markerRawSvg = await Http.request({
129
135
  method: 'GET',
130
136
  versioned: false,
131
- path: `maps/markers/${customMarker.id}`,
137
+ path: `maps/${radarCustomStyleId}/markers/${customMarker.id}`,
132
138
  headers: {
133
139
  'Content-Type': 'image/svg+xml',
134
140
  },
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '4.2.0-beta.1';
1
+ export default '4.2.0-beta.4';