diff --git a/API.md b/API.md index 38ea1556..b3527589 100644 --- a/API.md +++ b/API.md @@ -75,6 +75,8 @@ * [Parameters][71] * [getAddressInfo][72] * [Parameters][73] +* [getV6AddressInfo][74] + * [Parameters][75] ## getFooterNode @@ -82,52 +84,53 @@ Don't include this as part of the options object when creating a new MapboxGeoco ## MapboxGeocoder -A geocoder component using the [Mapbox Geocoding API][74] +A geocoder component using the [Mapbox Geocoding API][76] ### Parameters -* `options` **[Object][75]** - - * `options.accessToken` **[String][76]** Required. - * `options.origin` **[String][76]** Use to set a custom API origin. (optional, default `https://api.mapbox.com`) - * `options.mapboxgl` **[Object][75]?** A [mapbox-gl][77] instance to use when creating [Markers][78]. Required if `options.marker` is `true`. - * `options.zoom` **[Number][79]** On geocoded result what zoom level should the map animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`. (optional, default `16`) - * `options.flyTo` **([Boolean][80] | [Object][75])** If `false`, animating the map to a selected result is disabled. If `true`, animating the map will use the default animation parameters. If an object, it will be passed as `options` to the map [`flyTo`][81] or [`fitBounds`][82] method providing control over the animation of the transition. (optional, default `true`) - * `options.placeholder` **[String][76]** Override the default placeholder attribute value. (optional, default `Search`) - * `options.proximity` **([Object][75] | `"ip"`)?** a geographical point given as an object with `latitude` and `longitude` properties, or the string 'ip' to use a user's IP address location. Search results closer to this point will be given higher priority. - * `options.trackProximity` **[Boolean][80]** If `true`, the geocoder proximity will dynamically update based on the current map view or user's IP location, depending on zoom level. (optional, default `true`) - * `options.collapsed` **[Boolean][80]** If `true`, the geocoder control will collapse until hovered or in focus. (optional, default `false`) - * `options.clearAndBlurOnEsc` **[Boolean][80]** If `true`, the geocoder control will clear it's contents and blur when user presses the escape key. (optional, default `false`) - * `options.clearOnBlur` **[Boolean][80]** If `true`, the geocoder control will clear its value when the input blurs. (optional, default `false`) - * `options.bbox` **[Array][83]?** a bounding box argument: this is +* `options` **[Object][77]** + + * `options.accessToken` **[String][78]** Required. + * `options.origin` **[String][78]** Use to set a custom API origin. (optional, default `https://api.mapbox.com`) + * `options.mapboxgl` **[Object][77]?** A [mapbox-gl][79] instance to use when creating [Markers][80]. Required if `options.marker` is `true`. + * `options.zoom` **[Number][81]** On geocoded result what zoom level should the map animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`. (optional, default `16`) + * `options.flyTo` **([Boolean][82] | [Object][77])** If `false`, animating the map to a selected result is disabled. If `true`, animating the map will use the default animation parameters. If an object, it will be passed as `options` to the map [`flyTo`][83] or [`fitBounds`][84] method providing control over the animation of the transition. (optional, default `true`) + * `options.placeholder` **[String][78]** Override the default placeholder attribute value. (optional, default `Search`) + * `options.proximity` **([Object][77] | `"ip"`)?** a geographical point given as an object with `latitude` and `longitude` properties, or the string 'ip' to use a user's IP address location. Search results closer to this point will be given higher priority. + * `options.trackProximity` **[Boolean][82]** If `true`, the geocoder proximity will dynamically update based on the current map view or user's IP location, depending on zoom level. (optional, default `true`) + * `options.collapsed` **[Boolean][82]** If `true`, the geocoder control will collapse until hovered or in focus. (optional, default `false`) + * `options.clearAndBlurOnEsc` **[Boolean][82]** If `true`, the geocoder control will clear it's contents and blur when user presses the escape key. (optional, default `false`) + * `options.clearOnBlur` **[Boolean][82]** If `true`, the geocoder control will clear its value when the input blurs. (optional, default `false`) + * `options.bbox` **[Array][85]?** a bounding box argument: this is a bounding box given as an array in the format `[minX, minY, maxX, maxY]`. Search results will be limited to the bounding box. - * `options.countries` **[string][76]?** a comma separated list of country codes to + * `options.countries` **[string][78]?** a comma separated list of country codes to limit results to specified country or countries. - * `options.types` **[string][76]?** a comma seperated list of types that filter - results to match those specified. See [https://docs.mapbox.com/api/search/#data-types][84] + * `options.types` **[string][78]?** a comma seperated list of types that filter + results to match those specified. See [https://docs.mapbox.com/api/search/#data-types][86] for available types. If reverseGeocode is enabled and no type is specified, the type defaults to POIs. Otherwise, if you configure more than one type, the first type will be used. - * `options.minLength` **[Number][79]** Minimum number of characters to enter before results are shown. (optional, default `2`) - * `options.limit` **[Number][79]** Maximum number of results to show. (optional, default `5`) - * `options.language` **[string][76]?** Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. Defaults to the browser's language settings. - * `options.filter` **[Function][85]?** A function which accepts a Feature in the [Carmen GeoJSON][86] format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise. - * `options.localGeocoder` **[Function][85]?** A function accepting the query string which performs local geocoding to supplement results from the Mapbox Geocoding API. Expected to return an Array of GeoJSON Features in the [Carmen GeoJSON][86] format. - * `options.externalGeocoder` **[Function][85]?** A function accepting the query string and current features list which performs geocoding to supplement results from the Mapbox Geocoding API. Expected to return a Promise which resolves to an Array of GeoJSON Features in the [Carmen GeoJSON][86] format. + * `options.minLength` **[Number][81]** Minimum number of characters to enter before results are shown. (optional, default `2`) + * `options.limit` **[Number][81]** Maximum number of results to show. (optional, default `5`) + * `options.language` **[string][78]?** Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. Defaults to the browser's language settings. + * `options.filter` **[Function][87]?** A function which accepts a Feature in the [Carmen GeoJSON][88] format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise. + * `options.localGeocoder` **[Function][87]?** A function accepting the query string which performs local geocoding to supplement results from the Mapbox Geocoding API. Expected to return an Array of GeoJSON Features in the [Carmen GeoJSON][88] format. + * `options.externalGeocoder` **[Function][87]?** A function accepting the query string and current features list which performs geocoding to supplement results from the Mapbox Geocoding API. Expected to return a Promise which resolves to an Array of GeoJSON Features in the [Carmen GeoJSON][88] format. * `options.reverseMode` **(distance | score)** Set the factors that are used to sort nearby results. (optional, default `distance`) - * `options.reverseGeocode` **[boolean][80]** If `true`, enable reverse geocoding mode. In reverse geocoding, search input is expected to be coordinates in the form `lat, lon`, with suggestions being the reverse geocodes. (optional, default `false`) - * `options.flipCoordinates` **[boolean][80]** If `true`, search input coordinates for reverse geocoding is expected to be in the form `lon, lat` instead of the default `lat, lon`. (optional, default `false`) - * `options.enableEventLogging` **[Boolean][80]** Allow Mapbox to collect anonymous usage statistics from the plugin. (optional, default `true`) - * `options.marker` **([Boolean][80] | [Object][75])** If `true`, a [Marker][78] will be added to the map at the location of the user-selected result using a default set of Marker options. If the value is an object, the marker will be constructed using these options. If `false`, no marker will be added to the map. Requires that `options.mapboxgl` also be set. (optional, default `true`) - * `options.render` **[Function][85]?** A function that specifies how the results should be rendered in the dropdown menu. This function should accepts a single [Carmen GeoJSON][86] object as input and return a string. Any HTML in the returned string will be rendered. - * `options.getItemValue` **[Function][85]?** A function that specifies how the selected result should be rendered in the search bar. This function should accept a single [Carmen GeoJSON][86] object as input and return a string. HTML tags in the output string will not be rendered. Defaults to `(item) => item.place_name`. - * `options.mode` **[String][76]** A string specifying the geocoding [endpoint][87] to query. Options are `mapbox.places` and `mapbox.places-permanent`. The `mapbox.places-permanent` mode requires an enterprise license for permanent geocodes. (optional, default `mapbox.places`) - * `options.localGeocoderOnly` **[Boolean][80]** If `true`, indicates that the `localGeocoder` results should be the only ones returned to the user. If `false`, indicates that the `localGeocoder` results should be combined with those from the Mapbox API with the `localGeocoder` results ranked higher. (optional, default `false`) - * `options.autocomplete` **[Boolean][80]** Specify whether to return autocomplete results or not. When autocomplete is enabled, results will be included that start with the requested string, rather than just responses that match it exactly. (optional, default `true`) - * `options.fuzzyMatch` **[Boolean][80]** Specify whether the Geocoding API should attempt approximate, as well as exact, matching when performing searches, or whether it should opt out of this behavior and only attempt exact matching. (optional, default `true`) - * `options.routing` **[Boolean][80]** Specify whether to request additional metadata about the recommended navigation destination corresponding to the feature or not. Only applicable for address features. (optional, default `false`) - * `options.worldview` **[String][76]** Filter results to geographic features whose characteristics are defined differently by audiences belonging to various regional, cultural, or political groups. (optional, default `"us"`) - * `options.enableGeolocation` **[Boolean][80]** If `true` enable user geolocation feature. (optional, default `false`) + * `options.reverseGeocode` **[boolean][82]** If `true`, enable reverse geocoding mode. In reverse geocoding, search input is expected to be coordinates in the form `lat, lon`, with suggestions being the reverse geocodes. (optional, default `false`) + * `options.flipCoordinates` **[boolean][82]** If `true`, search input coordinates for reverse geocoding is expected to be in the form `lon, lat` instead of the default `lat, lon`. (optional, default `false`) + * `options.enableEventLogging` **[Boolean][82]** Allow Mapbox to collect anonymous usage statistics from the plugin. (optional, default `true`) + * `options.marker` **([Boolean][82] | [Object][77])** If `true`, a [Marker][80] will be added to the map at the location of the user-selected result using a default set of Marker options. If the value is an object, the marker will be constructed using these options. If `false`, no marker will be added to the map. Requires that `options.mapboxgl` also be set. (optional, default `true`) + * `options.render` **[Function][87]?** A function that specifies how the results should be rendered in the dropdown menu. This function should accepts a single [Carmen GeoJSON][88] object as input and return a string. Any HTML in the returned string will be rendered. + * `options.getItemValue` **[Function][87]?** A function that specifies how the selected result should be rendered in the search bar. This function should accept a single [Carmen GeoJSON][88] object as input and return a string. HTML tags in the output string will not be rendered. Defaults to `(item) => item.place_name`. + * `options.mode` **[String][78]** A string specifying the geocoding [endpoint][89] to query. Options are `mapbox.places` and `mapbox.places-permanent`. The `mapbox.places-permanent` mode requires an enterprise license for permanent geocodes. (optional, default `mapbox.places`) + * `options.localGeocoderOnly` **[Boolean][82]** If `true`, indicates that the `localGeocoder` results should be the only ones returned to the user. If `false`, indicates that the `localGeocoder` results should be combined with those from the Mapbox API with the `localGeocoder` results ranked higher. (optional, default `false`) + * `options.autocomplete` **[Boolean][82]** Specify whether to return autocomplete results or not. When autocomplete is enabled, results will be included that start with the requested string, rather than just responses that match it exactly. (optional, default `true`) + * `options.fuzzyMatch` **[Boolean][82]** Specify whether the Geocoding API should attempt approximate, as well as exact, matching when performing searches, or whether it should opt out of this behavior and only attempt exact matching. (optional, default `true`) + * `options.routing` **[Boolean][82]** Specify whether to request additional metadata about the recommended navigation destination corresponding to the feature or not. Only applicable for address features. (optional, default `false`) + * `options.worldview` **[String][78]** Filter results to geographic features whose characteristics are defined differently by audiences belonging to various regional, cultural, or political groups. (optional, default `"us"`) + * `options.enableGeolocation` **[Boolean][82]** If `true` enable user geolocation feature. (optional, default `false`) + * `options.version` **(`"v5"` | `"v6"`)** If `v6` use v6 endpoint instead of v5. The default value is set to v5 API. (optional, default `'v5'`) * `options.addressAccuracy` **(`"address"` | `"street"` | `"place"` | `"country"`)** The accuracy for the geolocation feature with which we define the address line to fill. The browser API returns the user's position with accuracy, and sometimes we can get the neighbor's address. To prevent receiving an incorrect address, you can reduce the accuracy of the definition. (optional, default `"street"`) ### Examples @@ -143,9 +146,9 @@ Returns **[MapboxGeocoder][2]** `this` Add the geocoder to a container. The container can be either a `mapboxgl.Map`, an `HTMLElement` or a CSS selector string. -If the container is a [`mapboxgl.Map`][88], this function will behave identically to [`Map.addControl(geocoder)`][89]. -If the container is an instance of [`HTMLElement`][90], then the geocoder will be appended as a child of that [`HTMLElement`][90]. -If the container is a [CSS selector string][91], the geocoder will be appended to the element returned from the query. +If the container is a [`mapboxgl.Map`][90], this function will behave identically to [`Map.addControl(geocoder)`][91]. +If the container is an instance of [`HTMLElement`][92], then the geocoder will be appended as a child of that [`HTMLElement`][92]. +If the container is a [CSS selector string][93], the geocoder will be appended to the element returned from the query. This function will throw an error if the container is none of the above. It will also throw an error if the referenced HTML element cannot be found in the `document.body`. @@ -159,7 +162,7 @@ geocoder.addTo('#geocoder-container'); #### Parameters -* `container` **([String][76] | [HTMLElement][92] | mapboxgl.Map)** A reference to the container to which to add the geocoder +* `container` **([String][78] | [HTMLElement][94] | mapboxgl.Map)** A reference to the container to which to add the geocoder ### clear @@ -167,7 +170,7 @@ Clear and then focus the input. #### Parameters -* `ev` **[Event][93]?** the event that triggered the clear, if available +* `ev` **[Event][95]?** the event that triggered the clear, if available ### query @@ -175,7 +178,7 @@ Set & query the input #### Parameters -* `searchInput` **[string][76]** location name or other search input +* `searchInput` **[string][78]** location name or other search input Returns **[MapboxGeocoder][2]** this @@ -185,8 +188,8 @@ Set input #### Parameters -* `searchInput` **[string][76]** location name or other search input -- `showSuggestions` **[boolean][80]** display suggestion on setInput call (optional, default `false`) +* `searchInput` **[string][78]** location name or other search input +* `showSuggestions` **[boolean][82]** display suggestion on setInput call (optional, default `false`) Returns **[MapboxGeocoder][2]** this @@ -196,8 +199,8 @@ Set proximity #### Parameters -* `proximity` **([Object][75] | `"ip"`)** The new `options.proximity` value. This is a geographical point given as an object with `latitude` and `longitude` properties or the string 'ip'. -* `disableTrackProximity` **[Boolean][80]** If true, sets `trackProximity` to false. True by default to prevent `trackProximity` from unintentionally overriding an explicitly set proximity value. (optional, default `true`) +* `proximity` **([Object][77] | `"ip"`)** The new `options.proximity` value. This is a geographical point given as an object with `latitude` and `longitude` properties or the string 'ip'. +* `disableTrackProximity` **[Boolean][82]** If true, sets `trackProximity` to false. True by default to prevent `trackProximity` from unintentionally overriding an explicitly set proximity value. (optional, default `true`) Returns **[MapboxGeocoder][2]** this @@ -205,7 +208,7 @@ Returns **[MapboxGeocoder][2]** this Get proximity -Returns **[Object][75]** The geocoder proximity +Returns **[Object][77]** The geocoder proximity ### setRenderFunction @@ -213,7 +216,7 @@ Set the render function used in the results dropdown #### Parameters -* `fn` **[Function][85]** The function to use as a render function. This function accepts a single [Carmen GeoJSON][86] object as input and returns a string. +* `fn` **[Function][87]** The function to use as a render function. This function accepts a single [Carmen GeoJSON][88] object as input and returns a string. Returns **[MapboxGeocoder][2]** this @@ -221,7 +224,7 @@ Returns **[MapboxGeocoder][2]** this Get the function used to render the results dropdown -Returns **[Function][85]** the render function +Returns **[Function][87]** the render function ### setLanguage @@ -231,7 +234,7 @@ Look first at the explicitly set options otherwise use the browser's language se #### Parameters -* `language` **[String][76]** Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. +* `language` **[String][78]** Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. Returns **[MapboxGeocoder][2]** this @@ -239,13 +242,13 @@ Returns **[MapboxGeocoder][2]** this Get the language to use in UI elements and when making search requests -Returns **[String][76]** The language(s) used by the plugin, if any +Returns **[String][78]** The language(s) used by the plugin, if any ### getZoom Get the zoom level the map will move to when there is no bounding box on the selected result -Returns **[Number][79]** the map zoom +Returns **[Number][81]** the map zoom ### setZoom @@ -253,7 +256,7 @@ Set the zoom level #### Parameters -* `zoom` **[Number][79]** The zoom level that the map should animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`. +* `zoom` **[Number][81]** The zoom level that the map should animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`. Returns **[MapboxGeocoder][2]** this @@ -261,7 +264,7 @@ Returns **[MapboxGeocoder][2]** this Get the parameters used to fly to the selected response, if any -Returns **([Boolean][80] | [Object][75])** The `flyTo` option +Returns **([Boolean][82] | [Object][77])** The `flyTo` option ### setFlyTo @@ -269,13 +272,13 @@ Set the flyTo options #### Parameters -* `flyTo` **([Boolean][80] | [Object][75])** If false, animating the map to a selected result is disabled. If true, animating the map will use the default animation parameters. If an object, it will be passed as `options` to the map [`flyTo`][81] or [`fitBounds`][82] method providing control over the animation of the transition. +* `flyTo` **([Boolean][82] | [Object][77])** If false, animating the map to a selected result is disabled. If true, animating the map will use the default animation parameters. If an object, it will be passed as `options` to the map [`flyTo`][83] or [`fitBounds`][84] method providing control over the animation of the transition. ### getPlaceholder Get the value of the placeholder string -Returns **[String][76]** The input element's placeholder value +Returns **[String][78]** The input element's placeholder value ### setPlaceholder @@ -283,7 +286,7 @@ Set the value of the input element's placeholder #### Parameters -* `placeholder` **[String][76]** the text to use as the input element's placeholder +* `placeholder` **[String][78]** the text to use as the input element's placeholder Returns **[MapboxGeocoder][2]** this @@ -291,7 +294,7 @@ Returns **[MapboxGeocoder][2]** this Get the bounding box used by the plugin -Returns **[Array][83]<[Number][79]>** the bounding box, if any +Returns **[Array][85]<[Number][81]>** the bounding box, if any ### setBbox @@ -299,7 +302,7 @@ Set the bounding box to limit search results to #### Parameters -* `bbox` **[Array][83]<[Number][79]>** a bounding box given as an array in the format \[minX, minY, maxX, maxY]. +* `bbox` **[Array][85]<[Number][81]>** a bounding box given as an array in the format \[minX, minY, maxX, maxY]. Returns **[MapboxGeocoder][2]** this @@ -307,7 +310,7 @@ Returns **[MapboxGeocoder][2]** this Get a list of the countries to limit search results to -Returns **[String][76]** a comma separated list of countries to limit to, if any +Returns **[String][78]** a comma separated list of countries to limit to, if any ### setCountries @@ -315,7 +318,7 @@ Set the countries to limit search results to #### Parameters -* `countries` **[String][76]** a comma separated list of countries to limit to +* `countries` **[String][78]** a comma separated list of countries to limit to Returns **[MapboxGeocoder][2]** this @@ -323,7 +326,7 @@ Returns **[MapboxGeocoder][2]** this Get a list of the types to limit search results to -Returns **[String][76]** a comma separated list of types to limit to +Returns **[String][78]** a comma separated list of types to limit to ### setTypes @@ -332,7 +335,7 @@ Set the types to limit search results to #### Parameters * `types` -* `countries` **[String][76]** a comma separated list of types to limit to +* `countries` **[String][78]** a comma separated list of types to limit to Returns **[MapboxGeocoder][2]** this @@ -340,7 +343,7 @@ Returns **[MapboxGeocoder][2]** this Get the minimum number of characters typed to trigger results used in the plugin -Returns **[Number][79]** The minimum length in characters before a search is triggered +Returns **[Number][81]** The minimum length in characters before a search is triggered ### setMinLength @@ -348,7 +351,7 @@ Set the minimum number of characters typed to trigger results used by the plugin #### Parameters -* `minLength` **[Number][79]** the minimum length in characters +* `minLength` **[Number][81]** the minimum length in characters Returns **[MapboxGeocoder][2]** this @@ -356,7 +359,7 @@ Returns **[MapboxGeocoder][2]** this Get the limit value for the number of results to display used by the plugin -Returns **[Number][79]** The limit value for the number of results to display used by the plugin +Returns **[Number][81]** The limit value for the number of results to display used by the plugin ### setLimit @@ -364,7 +367,7 @@ Set the limit value for the number of results to display used by the plugin #### Parameters -* `limit` **[Number][79]** the number of search results to return +* `limit` **[Number][81]** the number of search results to return Returns **[MapboxGeocoder][2]** @@ -372,7 +375,7 @@ Returns **[MapboxGeocoder][2]** Get the filter function used by the plugin -Returns **[Function][85]** the filter function +Returns **[Function][87]** the filter function ### setFilter @@ -380,7 +383,7 @@ Set the filter function used by the plugin. #### Parameters -* `filter` **[Function][85]** A function which accepts a Feature in the [Carmen GeoJSON][86] format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise. +* `filter` **[Function][87]** A function which accepts a Feature in the [Carmen GeoJSON][88] format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise. Returns **[MapboxGeocoder][2]** this @@ -390,7 +393,7 @@ Set the geocoding endpoint used by the plugin. #### Parameters -* `origin` **[Function][85]** A function which accepts an HTTPS URL to specify the endpoint to query results from. +* `origin` **[Function][87]** A function which accepts an HTTPS URL to specify the endpoint to query results from. Returns **[MapboxGeocoder][2]** this @@ -398,7 +401,7 @@ Returns **[MapboxGeocoder][2]** this Get the geocoding endpoint the plugin is currently set to -Returns **[Function][85]** the endpoint URL +Returns **[Function][87]** the endpoint URL ### setAccessToken @@ -406,7 +409,7 @@ Set the accessToken option used for the geocoding request endpoint. #### Parameters -* `accessToken` **[String][76]** value +* `accessToken` **[String][78]** value Returns **[MapboxGeocoder][2]** this @@ -416,13 +419,13 @@ Set the autocomplete option used for geocoding requests #### Parameters -* `value` **[Boolean][80]** The boolean value to set autocomplete to +* `value` **[Boolean][82]** The boolean value to set autocomplete to ### getAutocomplete Get the current autocomplete parameter value used for requests -Returns **[Boolean][80]** The autocomplete parameter value +Returns **[Boolean][82]** The autocomplete parameter value ### setFuzzyMatch @@ -430,13 +433,13 @@ Set the fuzzyMatch option used for approximate matching in geocoding requests #### Parameters -* `value` **[Boolean][80]** The boolean value to set fuzzyMatch to +* `value` **[Boolean][82]** The boolean value to set fuzzyMatch to ### getFuzzyMatch Get the current fuzzyMatch parameter value used for requests -Returns **[Boolean][80]** The fuzzyMatch parameter value +Returns **[Boolean][82]** The fuzzyMatch parameter value ### setRouting @@ -444,13 +447,13 @@ Set the routing parameter used to ask for routable point metadata in geocoding r #### Parameters -* `value` **[Boolean][80]** The boolean value to set routing to +* `value` **[Boolean][82]** The boolean value to set routing to ### getRouting Get the current routing parameter value used for requests -Returns **[Boolean][80]** The routing parameter value +Returns **[Boolean][82]** The routing parameter value ### setWorldview @@ -458,13 +461,13 @@ Set the worldview parameter #### Parameters -* `code` **[String][76]** The country code representing the worldview (e.g. "us" | "cn" | "jp", "in") +* `code` **[String][78]** The country code representing the worldview (e.g. "us" | "cn" | "jp", "in") ### getWorldview Get the current worldview parameter value used for requests -Returns **[String][76]** The worldview parameter value +Returns **[String][78]** The worldview parameter value ### on @@ -472,12 +475,12 @@ Subscribe to events that happen within the plugin. #### Parameters -* `type` **[String][76]** name of event. Available events and the data passed into their respective event objects are:* **clear** `Emitted when the input is cleared` +* `type` **[String][78]** name of event. Available events and the data passed into their respective event objects are:* **clear** `Emitted when the input is cleared` * **loading** `{ query } Emitted when the geocoder is looking up a query` * **results** `{ results } Fired when the geocoder returns a response` * **result** `{ result } Fired when input is set` * **error** `{ error } Error as string` -* `fn` **[Function][85]** function that's called when the event is emitted. +* `fn` **[Function][87]** function that's called when the event is emitted. Returns **[MapboxGeocoder][2]** this; @@ -487,8 +490,8 @@ Remove an event #### Parameters -* `type` **[String][76]** Event name. -* `fn` **[Function][85]** Function that should unsubscribe to the event emitted. +* `type` **[String][78]** Event name. +* `fn` **[Function][87]** Function that should unsubscribe to the event emitted. Returns **[MapboxGeocoder][2]** this @@ -498,8 +501,9 @@ This function transforms the feature from reverse geocoding to plain text with s ### Parameters -* `feature` **[object][75]** -* `accuracy` **[string][76]** +* `feature` **[object][77]** +* `accuracy` **[string][78]** +* `version` **(`"v5"` | `"v6"`)** ## getAddressInfo @@ -507,9 +511,20 @@ This function transforms the feature from reverse geocoding to AddressInfo objec ### Parameters -* `feature` **[object][75]** +* `feature` **[object][77]** +* `version` **(`"v5"` | `"v6"`)** -Returns **[object][75]** +Returns **[object][77]** + +## getV6AddressInfo + +This function transforms the v6 feature from reverse geocoding to AddressInfo object + +### Parameters + +* `feature` **[object][77]** + +Returns **[object][77]** [1]: #getfooternode @@ -657,42 +672,46 @@ Returns **[object][75]** [73]: #parameters-26 -[74]: https://docs.mapbox.com/api/search/#geocoding +[74]: #getv6addressinfo + +[75]: #parameters-27 + +[76]: https://docs.mapbox.com/api/search/#geocoding -[75]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object +[77]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object -[76]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String +[78]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String -[77]: https://github.com/mapbox/mapbox-gl-js +[79]: https://github.com/mapbox/mapbox-gl-js -[78]: https://docs.mapbox.com/mapbox-gl-js/api/#marker +[80]: https://docs.mapbox.com/mapbox-gl-js/api/#marker -[79]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number +[81]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number -[80]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean +[82]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean -[81]: https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto +[83]: https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto -[82]: https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds +[84]: https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds -[83]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array +[85]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array -[84]: https://docs.mapbox.com/api/search/#data-types +[86]: https://docs.mapbox.com/api/search/#data-types -[85]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function +[87]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function -[86]: https://github.com/mapbox/carmen/blob/master/carmen-geojson.md +[88]: https://github.com/mapbox/carmen/blob/master/carmen-geojson.md -[87]: https://docs.mapbox.com/api/search/#endpoints +[89]: https://docs.mapbox.com/api/search/#endpoints -[88]: https://docs.mapbox.com/mapbox-gl-js/api/map/ +[90]: https://docs.mapbox.com/mapbox-gl-js/api/map/ -[89]: https://docs.mapbox.com/mapbox-gl-js/api/map/#map#addcontrol +[91]: https://docs.mapbox.com/mapbox-gl-js/api/map/#map#addcontrol -[90]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement +[92]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement -[91]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors +[93]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors -[92]: https://developer.mozilla.org/docs/Web/HTML/Element +[94]: https://developer.mozilla.org/docs/Web/HTML/Element -[93]: https://developer.mozilla.org/docs/Web/API/Event +[95]: https://developer.mozilla.org/docs/Web/API/Event diff --git a/CHANGELOG.md b/CHANGELOG.md index 50bbbbd9..956e16bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## HEAD +## 5.1.0-beta.0 + +### Features / Improvements 🚀 + +- Added version="v5"|"v6" flag to the options of the MapboxGeocoder class which makes it possible to use v6 endpoint instead of v5 by default for geocoding. [#485](https://github.com/mapbox/mapbox-gl-geocoder/pull/485). For more details please refer to [v6 API documentation](https://docs.mapbox.com/api/search/geocoding-v6/). + ## 5.0.1 ### Bug fixes 🐛 diff --git a/debug/index.js b/debug/index.js index d9568ff5..79b5849e 100644 --- a/debug/index.js +++ b/debug/index.js @@ -85,7 +85,9 @@ var geocoder = new MapboxGeocoder({ .then(response => response.json()) } }, - mapboxgl: mapboxgl + mapboxgl: mapboxgl, + reverseGeocode: true, + version: 'v6', }); map.addControl(geocoder) diff --git a/debug/mock-api.json b/debug/mock-api.json index 8c763076..1ffb7d48 100644 --- a/debug/mock-api.json +++ b/debug/mock-api.json @@ -1,3 +1,66 @@ [ - {"id":"place.7673410831246050","type":"Feature","place_type":["place"],"relevance":1,"properties":{"wikidata":"Q61"},"text_en-US":"Washington","language_en-US":"en","place_name_en-US":"Washington, District of Columbia, United States of America","text":"Washington","language":"en","place_name":"SERVER: Washington, District of Columbia, United States of America","matching_place_name":"Washington, DC, United States of America","bbox":[-77.1197609567342,38.79155738,-76.909391,38.99555093],"center":[-77.0366,38.895],"geometry":{"type":"Point","coordinates":[-77.0366,38.895]},"context":[{"id":"region.14064402149979320","short_code":"US-DC","wikidata":"Q3551781","text_en-US":"District of Columbia","language_en-US":"en","text":"District of Columbia","language":"en"},{"id":"country.19678805456372290","wikidata":"Q30","short_code":"us","text_en-US":"United States of America","language_en-US":"en","text":"United States of America","language":"en"}]} -] \ No newline at end of file + { + "type": "Feature", + "id": "address.7840146147075390", + "geometry": { + "type": "Point", + "coordinates": [22.476772, -33.991656] + }, + "properties": { + "mapbox_id": "address.7840146147075390", + "feature_type": "address", + "name": "12 Main Street", + "coordinates": { + "longitude": 22.476772, + "latitude": -33.991656, + "accuracy": "proximate" + }, + "place_formatted": "George, Western Cape 6529, South Africa", + "match_code": { + "address_number": "matched", + "street": "unmatched", + "postcode": "unmatched", + "place": "unmatched", + "region": "unmatched", + "locality": "not_applicable", + "country": "inferred", + "confidence": "low" + }, + "context": { + "address": { + "id": "address.7840146147075390", + "street": "Main Street", + "address_number": "12", + "name": "12 Main Street" + }, + "neighborhood": { + "id": "neighborhood.1846526", + "name": "Ballotsview" + }, + "postcode": { + "id": "postcode.24039166", + "name": "6529" + }, + "place": { + "id": "place.24643838", + "name": "George", + "wikidata_id": "Q370456" + }, + "region": { + "id": "region.9470", + "name": "Western Cape", + "wikidata_id": "Q127167", + "region_code": "WC", + "region_code_full": "ZA-WC" + }, + "country": { + "id": "country.8958", + "name": "South Africa", + "wikidata_id": "Q258", + "country_code": "ZA", + "country_code_alpha_3": "ZAF" + } + } + } + } +] diff --git a/lib/events.js b/lib/events.js index b92edb4b..5cb5dcfc 100644 --- a/lib/events.js +++ b/lib/events.js @@ -179,7 +179,8 @@ MapboxEventManager.prototype = { routing: geocoder.options.routing, worldview: geocoder.options.worldview, mapZoom: zoom, - keyboardLocale: this.locale + keyboardLocale: this.locale, + apiVersion: geocoder.options.version } // get the text in the search bar diff --git a/lib/index.js b/lib/index.js index ae741997..4d2ac00b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -7,6 +7,7 @@ var EventEmitter = require('events').EventEmitter; var exceptions = require('./exceptions'); var MapboxClient = require('@mapbox/mapbox-sdk'); var mbxGeocoder = require('@mapbox/mapbox-sdk/services/geocoding'); +var mbxGeocoderV6 = require("@mapbox/mapbox-sdk/services/geocoding-v6"); var MapboxEventManager = require('./events'); var localization = require('./localization'); var subtag = require('subtag'); @@ -31,6 +32,36 @@ function getFooterNode() { return div; } +function getItemValue(item) { + return item.place_name +} + +function render(item) { + var placeName = item.place_name.split(','); + return '
' + placeName[0]+ '
' + placeName.splice(1, placeName.length).join(',') + '
'; +} + +function getItemValueV6(item) { + const { name, place_formatted } = item.properties; + return name + (place_formatted ? `, ${place_formatted}` : ""); +} + +function renderV6(item) { + const { name, place_formatted } = item.properties; + return `
+ ${ + name + ? `
${name}
` + : "" +} + ${ + place_formatted + ? `
${place_formatted}
` + : "" +} +
`; +} + /** * A geocoder component using the [Mapbox Geocoding API](https://docs.mapbox.com/api/search/#geocoding) * @class MapboxGeocoder @@ -75,6 +106,7 @@ function getFooterNode() { * @param {Boolean} [options.routing=false] Specify whether to request additional metadata about the recommended navigation destination corresponding to the feature or not. Only applicable for address features. * @param {String} [options.worldview="us"] Filter results to geographic features whose characteristics are defined differently by audiences belonging to various regional, cultural, or political groups. * @param {Boolean} [options.enableGeolocation=false] If `true` enable user geolocation feature. + * @param {'v5'|'v6'} [options.version='v5'] If `v6` use v6 endpoint instead of v5. The default value is set to v5 API. * @param {('address'|'street'|'place'|'country')} [options.addressAccuracy="street"] The accuracy for the geolocation feature with which we define the address line to fill. The browser API returns the user's position with accuracy, and sometimes we can get the neighbor's address. To prevent receiving an incorrect address, you can reduce the accuracy of the definition. * @example * var geocoder = new MapboxGeocoder({ accessToken: mapboxgl.accessToken }); @@ -85,11 +117,15 @@ function getFooterNode() { function MapboxGeocoder(options) { this._eventEmitter = new EventEmitter(); - this.options = extend({}, this.options, options); + this.options = extend({}, this.options, { + getItemValue: options.version === 'v6' ? getItemValueV6 : getItemValue, + render: options.version === 'v6' ? renderV6 : render, + }, options); this.inputString = ''; this.fresh = true; this.lastSelected = null; this.geolocation = new Geolocation(); + this.geocoderFactory = this.options.version === 'v6' ? mbxGeocoderV6 : mbxGeocoder; } MapboxGeocoder.prototype = { @@ -110,13 +146,7 @@ MapboxGeocoder.prototype = { clearOnBlur: false, enableGeolocation: false, addressAccuracy: 'street', - getItemValue: function(item) { - return item.place_name - }, - render: function(item) { - var placeName = item.place_name.split(','); - return '
' + placeName[0]+ '
' + placeName.splice(1, placeName.length).join(',') + '
'; - } + version: 'v5' }, /** @@ -181,7 +211,7 @@ MapboxGeocoder.prototype = { this.setLanguage(); if (!this.options.localGeocoderOnly){ - this.geocoderService = mbxGeocoder( + this.geocoderService = this.geocoderFactory( MapboxClient({ accessToken: this.options.accessToken, origin: this.options.origin @@ -340,7 +370,13 @@ MapboxGeocoder.prototype = { this._showClearButton(); this.fresh = false; - const config = { + const config = this.options.version === 'v6' ? { + longitude: geojson.geometry.coordinates[0], + latitude: geojson.geometry.coordinates[1], + limit: 1, + language: this.options.language, + types: ["address"], + } : { limit: 1, language: [this.options.language], query: geojson.geometry.coordinates, @@ -357,7 +393,11 @@ MapboxGeocoder.prototype = { const feature = resp.body.features[0]; if (feature) { - const locationText = utils.transformFeatureToGeolocationText(feature, this.options.addressAccuracy); + const locationText = utils.transformFeatureToGeolocationText( + feature, + this.options.addressAccuracy, + this.options.version + ); this._setInputValue(locationText); feature.user_coordinates = geojson.geometry.coordinates; @@ -532,7 +572,16 @@ MapboxGeocoder.prototype = { _fly: function(selected) { var flyOptions; - if (selected.properties && exceptions[selected.properties.short_code]) { + const bbox = this.options.version === 'v6' ? selected.properties.bbox : selected.bbox; + + let exceptionCode; + if (this.options.version === 'v6' && selected.properties.feature_type === 'country') { + exceptionCode = selected.properties.context.country.country_code.toLowerCase(); + } else if (this.options.version === 'v5') { + exceptionCode = selected.properties && selected.properties.short_code; + } + + if (selected.properties && exceptions[exceptionCode]) { // Certain geocoder search results return (and therefore zoom to fit) // an unexpectedly large bounding box: for example, both Russia and the // USA span both sides of -180/180, or France includes the island of @@ -541,10 +590,9 @@ MapboxGeocoder.prototype = { // short-term solution; this may be amended as necessary. flyOptions = extend({}, this.options.flyTo); if (this._map){ - this._map.fitBounds(exceptions[selected.properties.short_code].bbox, flyOptions); + this._map.fitBounds(exceptions[exceptionCode].bbox, flyOptions); } - } else if (selected.bbox) { - var bbox = selected.bbox; + } else if (bbox) { flyOptions = extend({}, this.options.flyTo); if (this._map){ this._map.fitBounds([[bbox[0], bbox[1]], [bbox[2], bbox[3]]], flyOptions); @@ -581,6 +629,11 @@ MapboxGeocoder.prototype = { _setupConfig: function(requestType, search) { // Possible config properties to pass to client + const v5Keys = [ + 'fuzzyMatch', + 'routing', + 'reverseMode', + ]; const keys = [ 'bbox', 'limit', @@ -588,25 +641,24 @@ MapboxGeocoder.prototype = { 'countries', 'types', 'language', - 'reverseMode', 'mode', 'autocomplete', - 'fuzzyMatch', - 'routing', 'worldview' ]; + const allKeys = [...(this.options.version === 'v6' ? [] : v5Keys), ...keys]; + // countries, types, and language need to be passed in as arrays to client + // https://github.com/mapbox/mapbox-sdk-js/blob/master/services/geocoding.js#L38-L47 + const arrayParameters = ['countries', 'types', ...(this.options.version === 'v6' ? [] : ['language'])]; const spacesOrCommaRgx = /[\s,]+/; var self = this; - var config = keys.reduce(function(config, key) { + var config = allKeys.reduce(function(config, key) { // don't include undefined/null params, but allow boolean, among other, values if (self.options[key] === undefined || self.options[key] === null) { return config; } - // countries, types, and language need to be passed in as arrays to client - // https://github.com/mapbox/mapbox-sdk-js/blob/master/services/geocoding.js#L38-L47 - ['countries', 'types', 'language'].indexOf(key) > -1 + arrayParameters.indexOf(key) > -1 ? (config[key] = self.options[key].split(spacesOrCommaRgx)) : (config[key] = self.options[key]); @@ -626,24 +678,27 @@ MapboxGeocoder.prototype = { switch (requestType) { case GEOCODE_REQUEST_TYPE.REVERSE: { - var coords = search.split(spacesOrCommaRgx).map(function(c) { + // expected to be coordinates in the form `lat, lon` + var coords = search.trim().split(spacesOrCommaRgx).map(function(c) { return parseFloat(c, 10); }) if (!self.options.flipCoordinates) { + // flip order to `lon, lat` coords.reverse(); } - // client only accepts one type for reverseGeocode, so - // use first config type if one, if not default to poi - config.types ? [config.types[0]] : ["poi"]; - config = extend(config, { query: coords, limit: 1 }); + // validate coordinates in range before proceeding + if (coords[0] < -180 || coords[0] > 180) { + throw new Error('Longitude out of range'); + } else if (coords[1] < -90 || coords[1] > 90) { + throw new Error('Latitude out of range'); + } - // Remove config options not supported by the reverseGeocoder - ['proximity', 'autocomplete', 'fuzzyMatch', 'bbox'].forEach(function(key) { - if (key in config) { - delete config[key] - } - }); + config = extend(config, + this.options.version === 'v6' ? { longitude: coords[0], latitude: coords[1]} : { query: coords }, + !config.types && config.limit && config.limit !== 1 ? {limit: 1} : {}, // force limit=1 if no types and limit > 1 + config.types && config.types.length !== 1 ? {limit: 1 } : {} // force limit=1 if multiple types + ); } break; case GEOCODE_REQUEST_TYPE.FORWARD: { // Ensure that any reverse geocoding looking request is cleaned up @@ -657,6 +712,23 @@ MapboxGeocoder.prototype = { } break; } + if(this.options.version === 'v6' && config.mode) { + config.permanent = config.mode === 'mapbox.places-permanent'; + delete config.mode; + } + + // Remove config options not supported by the reverseGeocoder and v5 keys if v6 mode chosen + const unsupportedKeys = [ + ...(requestType === GEOCODE_REQUEST_TYPE.REVERSE ? ['proximity', 'autocomplete', 'fuzzyMatch', 'bbox'] : []), + ...(this.options.version === 'v6' ? v5Keys : []) + ]; + + unsupportedKeys.forEach(function(key) { + if (key in config) { + delete config[key] + } + }); + return config; }, @@ -666,7 +738,37 @@ MapboxGeocoder.prototype = { this._eventEmitter.emit('loading', { query: searchInput }); const requestType = this._requestType(this.options, searchInput); - const config = this._setupConfig(requestType, searchInput); + + var config; + // setup request parameters config and pre-validate values + try { + config = this._setupConfig(requestType, searchInput); + } catch (err) { + const request = new Promise(function (resolve) { + resolve(); + }); + request.then(function() { + return { + type: 'FeatureCollection', + features: [], + config + } + }.bind(this)) + .then(function(){ + this._hideLoadingIcon(); + this._hideAttribution(); + this._typeahead.selected = null; + this._renderCustomError(err.message); + this._eventEmitter.emit('results', { + type: 'FeatureCollection', + features: [], + config + }); + this._eventEmitter.emit('error', { error: err }); + + }.bind(this)) + return request + } var request; switch (requestType) { @@ -840,7 +942,9 @@ MapboxGeocoder.prototype = { if (!results.features.length) return; var result = results.features[0]; this._typeahead.selected = result; - this._inputEl.value = result.place_name; + this._inputEl.value = this.options.version === 'v6' ? + (result.properties.name + (result.properties.place_formatted ? `, ${result.properties.place_formatted}` : "")) : + result.place_name; this._onChange(); }, @@ -881,6 +985,11 @@ MapboxGeocoder.prototype = { var errorMessage = "
There was an error reaching the server
" this._renderMessage(errorMessage); }, + + _renderCustomError: function(message){ + var errorMessage = `
${message}
` + this._renderMessage(errorMessage); + }, _renderLocationError: function(){ var errorMessage = "
A location error has occurred
" @@ -1181,7 +1290,7 @@ MapboxGeocoder.prototype = { */ setOrigin: function(origin){ this.options.origin = origin; - this.geocoderService = mbxGeocoder( + this.geocoderService = this.geocoderFactory( MapboxClient({ accessToken: this.options.accessToken, origin: this.options.origin @@ -1205,7 +1314,7 @@ MapboxGeocoder.prototype = { */ setAccessToken: function(accessToken){ this.options.accessToken = accessToken; - this.geocoderService = mbxGeocoder( + this.geocoderService = this.geocoderFactory( MapboxClient({ accessToken: this.options.accessToken, origin: this.options.origin diff --git a/lib/utils.js b/lib/utils.js index 9c1027cb..7d176e2e 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,10 +2,11 @@ * This function transforms the feature from reverse geocoding to plain text with specified accuracy * @param {object} feature * @param {string} accuracy + * @param {'v5'|'v6'} version * @returns */ -function transformFeatureToGeolocationText(feature, accuracy) { - const addrInfo = getAddressInfo(feature); +function transformFeatureToGeolocationText(feature, accuracy, version) { + const addrInfo = getAddressInfo(feature, version); const addressAccuracy = ['address', 'street', 'place', 'country']; var currentAccuracy; @@ -34,12 +35,17 @@ function transformFeatureToGeolocationText(feature, accuracy) { return acc + addrInfo[name]; }, ''); } + /** * This function transforms the feature from reverse geocoding to AddressInfo object * @param {object} feature + * @param {'v5'|'v6'} version * @returns {object} */ -function getAddressInfo(feature) { +function getAddressInfo(feature, version) { + if(version === 'v6') { + return getV6AddressInfo(feature); + } const houseNumber = feature.address || ''; const street = feature.text || ''; const placeName = feature.place_name || ''; @@ -60,6 +66,33 @@ function getAddressInfo(feature) { return addrInfo; } +/** + * This function transforms the v6 feature from reverse geocoding to AddressInfo object + * @param {object} feature + * @returns {object} + */ +function getV6AddressInfo(feature) { + const houseNumber = feature.address_number || ""; + const street = feature.street || ""; + const placeName = feature.name + (feature.place_formatted ? `, ${feature.place_formatted}` : ""); + const address = feature.name; + + const addrInfo = { + address: address, + houseNumber: houseNumber, + street: street, + placeName: placeName, + }; + + for (const contextProp in feature.context) { + if (contextProp) { + addrInfo[contextProp] = feature.context[contextProp].name; + } + } + + return addrInfo; +} + const REVERSE_GEOCODE_COORD_RGX = /^[ ]*(-?\d{1,3}(\.\d{0,256})?)[, ]+(-?\d{1,3}(\.\d{0,256})?)[ ]*$/; module.exports = { diff --git a/package-lock.json b/package-lock.json index db5ed634..e584c560 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@mapbox/mapbox-gl-geocoder", - "version": "5.0.1", + "version": "5.1.0-beta.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -14645,4 +14645,4 @@ "dev": true } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 92cec594..31a84078 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mapbox/mapbox-gl-geocoder", - "version": "5.0.1", + "version": "5.1.0-beta.0", "description": "A geocoder control for Mapbox GL JS", "main": "lib/index.js", "unpkg": "dist/mapbox-gl-geocoder.min.js", @@ -64,7 +64,7 @@ "mapbox-gl": ">= 0.47.0 < 3.0.0" }, "dependencies": { - "@mapbox/mapbox-sdk": "^0.13.7", + "@mapbox/mapbox-sdk": "^0.15.0", "events": "^3.3.0", "lodash.debounce": "^4.0.6", "nanoid": "^3.1.31",