diff --git a/types/woosmap.map/index.d.ts b/types/woosmap.map/index.d.ts index 7a0d74eb675b49..66634152df73d4 100644 --- a/types/woosmap.map/index.d.ts +++ b/types/woosmap.map/index.d.ts @@ -124,6 +124,16 @@ declare namespace woosmap.map { setTilt(tilt: number): void; setZoom(zoom: number): void; + + /** + * Returns the current map type id. + */ + getMapTypeId(): string; + + /** + * Sets the map type id. + */ + setMapTypeId(mapTypeId: string): void; } } declare namespace woosmap.map { @@ -1204,10 +1214,6 @@ declare namespace woosmap.map { * and when a details is successful. */ _sessionId: string; - /** - * Public getter to allow reading the value - */ - sessionId: string; /** * Contains methods related to retrieving autocomplete predictions, geocoding for localities and retrieving details */ @@ -1242,10 +1248,6 @@ declare namespace woosmap.map { nearby( request: woosmap.map.localities.LocalitiesNearbyRequest, ): Promise; - - search( - request: woosmap.map.localities.LocalitiesSearchRequest, - ): Promise; } } declare namespace woosmap.map { @@ -1560,6 +1562,14 @@ declare namespace woosmap.map { * The initial heading to start from. */ heading?: number; + /** + * Whether to display the map type control. Defaults to false. + */ + mapTypeControl?: boolean; + /** + * The initial map type. Defaults to `MapTypeId.ROADMAP`. + */ + mapTypeId?: string; /** * ```json * [ @@ -2621,8 +2631,9 @@ declare namespace woosmap.map.stores { page?: number; /** * Find stores nearby an encoded polyline and inside a defined radius. + * The polyline as string is expected to be a google-encoded polyline. */ - polyline?: string | woosmap.map.LatLng[]; + polyline?: string | woosmap.map.LatLng[] | woosmap.map.LatLngLiteral[]; /** * Example: `query=name:'My cool store'|type:'click_and_collect'` * Search query combining one or more search clauses. @@ -3129,54 +3140,6 @@ declare namespace woosmap.map.localities { types: string | string[]; } } -declare namespace woosmap.map.localities { - interface LocalitiesSearchRequest { - /** - * The categories of points of interest to return. Multiple categories can be passed as an array of comma separated strings. - * Example: `categories=['tourism', 'education']` - */ - categories?: string | string[]; - /** - * Used to filter over countries. Countries must be passed as an - * ISO 3166-1 Alpha-2 or Alpha-3 compatible country code. - */ - components: woosmap.map.localities.LocalitiesComponentRestrictions; - /** - * The categories of points of interest to exclude from results. Multiple categories can be passed as an array of comma separated strings. - * Example: `excluded_categories=['hospitality.hostel','hospitality.guest_house']` - */ - excluded_categories?: string | string[]; - /** - * The types of suggestions to exclude. - * see available types to exclude [https://developers.woosmap.com/products/localities/search/#types](https://developers.woosmap.com/products/localities/search/#types) - */ - excluded_types?: string | string[]; - /** - * The user entered input string. - */ - input: string; - /** - * The language code, using ISO 3166-1 Alpha-2 country codes, - * indicating in which language the results should be returned, if possible. - * If language is not supplied, the Localities service will use english as default language. - */ - language?: string; - /** - * The center of the search circle. - */ - location: woosmap.map.LatLng | woosmap.map.LatLngLiteral; - /** - * Define the distance in meters within which the API will return results. - * Default radius if this parameter is not set is 100 000. - */ - radius?: number; - /** - * Types of targeted items. - * Available values are `point_of_interest`, `address`, `locality`, `postal_code`, `admin_level`, `country`. - */ - types: string | string[]; - } -} declare namespace woosmap.map.localities { /** * A Localities Autocomplete response returned by the call to @@ -3224,19 +3187,6 @@ declare namespace woosmap.map.localities { results: woosmap.map.localities.LocalitiesNearbyResult[]; } } -declare namespace woosmap.map.localities { - /** - * A Localities Search response returned by the call to - * `LocalitiesService.search` containing a - * list of `LocalitiesSearchResult`. - */ - interface LocalitiesSearchResponse { - /** - * The array of search results. - */ - results: woosmap.map.localities.LocalitiesSearchResult[]; - } -} declare namespace woosmap.map.localities { /** * Defines information about a Locality. @@ -3670,46 +3620,6 @@ declare namespace woosmap.map.localities { previous_page?: number; } } -declare namespace woosmap.map.localities { - /** - * The types of result returned by search. - */ - type LocalitiesSearchTypes = - | "point_of_interest" - | "address" - | "locality" - | "postal_code" - | "route" - | "admin_level" - | "country"; -} -declare namespace woosmap.map.localities { - /** - * Defines information about a Search element. - */ - interface LocalitiesSearchResult { - /** - * An array containing the categories of the result if it's a point of interest. - */ - categories?: string[]; - /** - * The description for the result. - */ - description?: string; - /** - * Contains a unique ID for each result. Please use this ID to give feedbacks on results. - */ - public_id: string; - /** - * The title for the result. - */ - title: string; - /** - * An array containing the types of the result. - */ - types: woosmap.map.localities.LocalitiesSearchTypes[]; - } -} declare namespace woosmap.map { /** * Summary feature response, part of DatasetsSearchResponse. @@ -4033,6 +3943,17 @@ declare namespace woosmap.map { defaultPolygonStrokeColor?: string; } } +declare namespace woosmap.map { + /** + * Identifiers for common map types. + * Specify these by value, or by using the constant's name. + * For example, `'roadmap'` or `woosmap.map.MapTypeId.ROADMAP`. + */ + enum MapTypeId { + HYBRID = "HYBRID", + ROADMAP = "ROADMAP", + } +} declare namespace woosmap.map { enum DirectionStatus { OK = "OK", diff --git a/types/woosmap.map/woosmap.map-tests.ts b/types/woosmap.map/woosmap.map-tests.ts index 557a5220b77ac1..e1446cf3d22343 100644 --- a/types/woosmap.map/woosmap.map-tests.ts +++ b/types/woosmap.map/woosmap.map-tests.ts @@ -1,5 +1,6 @@ // Tests for Woosmap Map JS API v1.4 // https://developers.woosmap.com/products/map-api/get-started/ +// /** * Display a Map @@ -21,6 +22,7 @@ const mapOptions = expectType({ }, ], enableMarkerAccessibleNavigation: true, + mapTypeId: woosmap.map.MapTypeId.ROADMAP, }) as woosmap.map.MapOptions; const map = new woosmap.map.Map(document.getElementById("mapContainer") as HTMLElement, mapOptions); @@ -48,6 +50,18 @@ map.remove(); // $ExpectType MVCArray map.overlayMapTypes; +/** + * MapTypeId + */ +// $ExpectType MapTypeId.ROADMAP +woosmap.map.MapTypeId.ROADMAP; +// $ExpectType MapTypeId.HYBRID +woosmap.map.MapTypeId.HYBRID; +// $ExpectType string +map.getMapTypeId(); +// $ExpectType void +map.setMapTypeId(woosmap.map.MapTypeId.HYBRID); + /** * Marker */ @@ -578,23 +592,6 @@ promiseLocalitiesNearby.then((result) => { // $ExpectType LocalitiesNearbyResponse result; }); -const localitiesSearchRequest = expectType({ - input: "royal al", - types: ["point_of_interest", "address"], - language: "EN", - components: { country: ["GB", "FR"] }, - radius: 5000000, - location: { lat: 51.5007, lng: -0.1246 }, - categories: ["tourism", "hospitality"], - excluded_categories: "hospitality.hostel", - excluded_types: ["admin_level", "village"], -}) as woosmap.map.localities.LocalitiesSearchRequest; - -const promiseLocalitiesSearch = localitiesService.search(localitiesSearchRequest); -promiseLocalitiesSearch.then((result) => { - // $ExpectType LocalitiesSearchResponse - result; -}); /** * Stores Service