radar-sdk-js 4.1.11 → 4.1.12

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.1.7/radar.min.js"></script>
59
+ <script src="https://js.radar.com/v4.1.12/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.1.7/radar.css" rel="stylesheet">
77
- <script src="https://js.radar.com/v4.1.7/radar.min.js"></script>
76
+ <link href="https://js.radar.com/v4.1.12/radar.css" rel="stylesheet">
77
+ <script src="https://js.radar.com/v4.1.12/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.1.7/radar.css" rel="stylesheet">
102
- <script src="https://js.radar.com/v4.1.7/radar.min.js"></script>
101
+ <link href="https://js.radar.com/v4.1.12/radar.css" rel="stylesheet">
102
+ <script src="https://js.radar.com/v4.1.12/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.1.7/radar.css" rel="stylesheet">
134
- <script src="https://js.radar.com/v4.1.7/radar.min.js"></script>
133
+ <link href="https://js.radar.com/v4.1.12/radar.css" rel="stylesheet">
134
+ <script src="https://js.radar.com/v4.1.12/radar.min.js"></script>
135
135
  </head>
136
136
 
137
137
  <body>
package/dist/radar.js CHANGED
@@ -565,7 +565,7 @@ var Navigator = /** @class */ (function () {
565
565
  return Navigator;
566
566
  }());
567
567
 
568
- var SDK_VERSION = '4.1.11';
568
+ var SDK_VERSION = '4.1.12';
569
569
 
570
570
  var Http = /** @class */ (function () {
571
571
  function Http() {
@@ -1037,12 +1037,12 @@ var RoutingAPI = /** @class */ (function () {
1037
1037
  }
1038
1038
  RoutingAPI.distance = function (params) {
1039
1039
  return __awaiter(this, void 0, void 0, function () {
1040
- var options, origin, destination, modes, units, geometry, geometryPoints, _a, latitude, longitude, latitude, longitude, latitude, longitude, response, distanceRes;
1040
+ var options, origin, destination, modes, units, geometry, geometryPoints, avoid, _a, latitude, longitude, latitude, longitude, latitude, longitude, response, distanceRes;
1041
1041
  return __generator(this, function (_b) {
1042
1042
  switch (_b.label) {
1043
1043
  case 0:
1044
1044
  options = Config.get();
1045
- origin = params.origin, destination = params.destination, modes = params.modes, units = params.units, geometry = params.geometry, geometryPoints = params.geometryPoints;
1045
+ origin = params.origin, destination = params.destination, modes = params.modes, units = params.units, geometry = params.geometry, geometryPoints = params.geometryPoints, avoid = params.avoid;
1046
1046
  if (!!origin) return [3 /*break*/, 2];
1047
1047
  return [4 /*yield*/, Navigator.getCurrentPosition()];
1048
1048
  case 1:
@@ -1063,6 +1063,9 @@ var RoutingAPI = /** @class */ (function () {
1063
1063
  if (Array.isArray(modes)) {
1064
1064
  modes = modes.join(',');
1065
1065
  }
1066
+ if (Array.isArray(avoid)) {
1067
+ avoid = avoid.join(',');
1068
+ }
1066
1069
  return [4 /*yield*/, Http.request({
1067
1070
  method: 'GET',
1068
1071
  path: 'route/distance',
@@ -1073,6 +1076,7 @@ var RoutingAPI = /** @class */ (function () {
1073
1076
  units: units,
1074
1077
  geometry: geometry,
1075
1078
  geometryPoints: geometryPoints,
1079
+ avoid: avoid,
1076
1080
  },
1077
1081
  })];
1078
1082
  case 4:
@@ -1090,12 +1094,12 @@ var RoutingAPI = /** @class */ (function () {
1090
1094
  };
1091
1095
  RoutingAPI.matrix = function (params) {
1092
1096
  return __awaiter(this, void 0, void 0, function () {
1093
- var options, origins, destinations, mode, units, _a, latitude, longitude, originStrings, i, response, matrixRes;
1097
+ var options, origins, destinations, mode, units, avoid, _a, latitude, longitude, originStrings, i, response, matrixRes;
1094
1098
  return __generator(this, function (_b) {
1095
1099
  switch (_b.label) {
1096
1100
  case 0:
1097
1101
  options = Config.get();
1098
- origins = params.origins, destinations = params.destinations, mode = params.mode, units = params.units;
1102
+ origins = params.origins, destinations = params.destinations, mode = params.mode, units = params.units, avoid = params.avoid;
1099
1103
  if (!!origins) return [3 /*break*/, 2];
1100
1104
  return [4 /*yield*/, Navigator.getCurrentPosition()];
1101
1105
  case 1:
@@ -1116,6 +1120,9 @@ var RoutingAPI = /** @class */ (function () {
1116
1120
  if (Array.isArray(destinations)) {
1117
1121
  destinations = destinations.map(function (location) { return "".concat(location.latitude, ",").concat(location.longitude); }).join('|');
1118
1122
  }
1123
+ if (Array.isArray(avoid)) {
1124
+ avoid = avoid.join(',');
1125
+ }
1119
1126
  return [4 /*yield*/, Http.request({
1120
1127
  method: 'GET',
1121
1128
  path: 'route/matrix',
@@ -1124,6 +1131,7 @@ var RoutingAPI = /** @class */ (function () {
1124
1131
  destinations: destinations,
1125
1132
  mode: mode,
1126
1133
  units: units,
1134
+ avoid: avoid,
1127
1135
  },
1128
1136
  })];
1129
1137
  case 4:
package/dist/radar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"radar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/types.d.ts CHANGED
@@ -27,6 +27,7 @@ export interface RadarResponse {
27
27
  response?: any;
28
28
  }
29
29
  export type RadarTravelMode = 'car' | 'foot' | 'bike' | 'motorbike' | 'truck';
30
+ export type RadarAvoidOption = 'tolls' | 'highways' | 'ferries';
30
31
  export interface RadarTripOptions {
31
32
  userId?: string;
32
33
  externalId?: string;
@@ -268,6 +269,7 @@ export interface RadarDistanceParams {
268
269
  units?: 'metric' | 'imperial';
269
270
  geometry?: boolean;
270
271
  geometryPoints?: boolean;
272
+ avoid?: RadarAvoidOption[] | string;
271
273
  }
272
274
  export interface RadarRouteDistance {
273
275
  value: number;
@@ -296,6 +298,7 @@ export interface RadarMatrixParams {
296
298
  destinations: Location[] | string;
297
299
  mode: RadarTravelMode;
298
300
  units?: 'metric' | 'imperial';
301
+ avoid?: RadarAvoidOption[] | string;
299
302
  }
300
303
  export interface RadarMatrixRoute {
301
304
  distance?: RadarRouteDistance;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "4.1.11";
1
+ declare const _default: "4.1.12";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "radar-sdk-js",
3
- "version": "4.1.11",
3
+ "version": "4.1.12",
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",
@@ -20,6 +20,7 @@ class RoutingAPI {
20
20
  units,
21
21
  geometry,
22
22
  geometryPoints,
23
+ avoid,
23
24
  } = params;
24
25
 
25
26
  // use browser location if "near" not provided
@@ -40,6 +41,10 @@ class RoutingAPI {
40
41
  modes = modes.join(',');
41
42
  }
42
43
 
44
+ if (Array.isArray(avoid)) {
45
+ avoid = avoid.join(',');
46
+ }
47
+
43
48
  const response: any = await Http.request({
44
49
  method: 'GET',
45
50
  path: 'route/distance',
@@ -50,6 +55,7 @@ class RoutingAPI {
50
55
  units,
51
56
  geometry,
52
57
  geometryPoints,
58
+ avoid,
53
59
  },
54
60
  });
55
61
 
@@ -72,6 +78,7 @@ class RoutingAPI {
72
78
  destinations,
73
79
  mode,
74
80
  units,
81
+ avoid,
75
82
  } = params;
76
83
 
77
84
  // use browser location if "near" not provided
@@ -91,6 +98,10 @@ class RoutingAPI {
91
98
  destinations = destinations.map((location) => `${location.latitude},${location.longitude}`).join('|');
92
99
  }
93
100
 
101
+ if (Array.isArray(avoid)) {
102
+ avoid = avoid.join(',');
103
+ }
104
+
94
105
  const response: any = await Http.request({
95
106
  method: 'GET',
96
107
  path: 'route/matrix',
@@ -99,6 +110,7 @@ class RoutingAPI {
99
110
  destinations,
100
111
  mode,
101
112
  units,
113
+ avoid,
102
114
  },
103
115
  });
104
116
 
package/src/types.ts CHANGED
@@ -42,6 +42,11 @@ export type RadarTravelMode =
42
42
  | 'motorbike'
43
43
  | 'truck';
44
44
 
45
+ export type RadarAvoidOption =
46
+ | 'tolls'
47
+ | 'highways'
48
+ | 'ferries';
49
+
45
50
  export interface RadarTripOptions {
46
51
  userId?: string;
47
52
  externalId?: string;
@@ -367,6 +372,7 @@ export interface RadarDistanceParams {
367
372
  units?: 'metric' | 'imperial';
368
373
  geometry?: boolean;
369
374
  geometryPoints?: boolean;
375
+ avoid?: RadarAvoidOption[] | string;
370
376
  }
371
377
 
372
378
 
@@ -402,6 +408,7 @@ export interface RadarMatrixParams {
402
408
  destinations: Location[] | string;
403
409
  mode: RadarTravelMode;
404
410
  units?: 'metric' | 'imperial';
411
+ avoid?: RadarAvoidOption[] | string;
405
412
  }
406
413
 
407
414
  export interface RadarMatrixRoute {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '4.1.11';
1
+ export default '4.1.12';