diff --git a/README.md b/README.md index ae91f908..f70f68a0 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Radar.initialize('prj_test_pk_...', { /* options */ }); Add the following script in your `html` file ```html - + ``` Then initialize the Radar SDK @@ -73,8 +73,8 @@ To create a map, first initialize the Radar SDK with your publishable key. Then ```html - - + + @@ -98,8 +98,8 @@ To create an autocomplete input, first initialize the Radar SDK with your publis ```html - - + + @@ -130,8 +130,8 @@ To power [geofencing](https://radar.com/documentation/geofencing/overview) exper ```html - - + + diff --git a/package-lock.json b/package-lock.json index 3cca7d30..165a70bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.1.11", + "version": "4.1.12", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index 096ce7bc..65657085 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.1.11", + "version": "4.1.12", "description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.", "homepage": "https://radar.com", "type": "module", diff --git a/src/api/routing.ts b/src/api/routing.ts index 0105dbf2..5f42346e 100644 --- a/src/api/routing.ts +++ b/src/api/routing.ts @@ -20,6 +20,7 @@ class RoutingAPI { units, geometry, geometryPoints, + avoid, } = params; // use browser location if "near" not provided @@ -40,6 +41,10 @@ class RoutingAPI { modes = modes.join(','); } + if (Array.isArray(avoid)) { + avoid = avoid.join(','); + } + const response: any = await Http.request({ method: 'GET', path: 'route/distance', @@ -50,6 +55,7 @@ class RoutingAPI { units, geometry, geometryPoints, + avoid, }, }); @@ -72,6 +78,7 @@ class RoutingAPI { destinations, mode, units, + avoid, } = params; // use browser location if "near" not provided @@ -91,6 +98,10 @@ class RoutingAPI { destinations = destinations.map((location) => `${location.latitude},${location.longitude}`).join('|'); } + if (Array.isArray(avoid)) { + avoid = avoid.join(','); + } + const response: any = await Http.request({ method: 'GET', path: 'route/matrix', @@ -99,6 +110,7 @@ class RoutingAPI { destinations, mode, units, + avoid, }, }); diff --git a/src/types.ts b/src/types.ts index b5ee958f..41cf76d0 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,6 +42,11 @@ export type RadarTravelMode = | 'motorbike' | 'truck'; +export type RadarAvoidOption = + | 'tolls' + | 'highways' + | 'ferries'; + export interface RadarTripOptions { userId?: string; externalId?: string; @@ -367,6 +372,7 @@ export interface RadarDistanceParams { units?: 'metric' | 'imperial'; geometry?: boolean; geometryPoints?: boolean; + avoid?: RadarAvoidOption[] | string; } @@ -402,6 +408,7 @@ export interface RadarMatrixParams { destinations: Location[] | string; mode: RadarTravelMode; units?: 'metric' | 'imperial'; + avoid?: RadarAvoidOption[] | string; } export interface RadarMatrixRoute { diff --git a/src/version.ts b/src/version.ts index 29681dc5..316fc28e 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '4.1.11'; +export default '4.1.12';