Skip to content

Commit cce9617

Browse files
wgsadminmanz
andauthored
🤖 Merge PR DefinitelyTyped#74423 chore: update woosmap.map by @wgsadmin
Co-authored-by: manz <manz@users.noreply.github.com>
1 parent c1870e1 commit cce9617

2 files changed

Lines changed: 45 additions & 127 deletions

File tree

types/woosmap.map/index.d.ts

Lines changed: 31 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,16 @@ declare namespace woosmap.map {
124124
setTilt(tilt: number): void;
125125

126126
setZoom(zoom: number): void;
127+
128+
/**
129+
* Returns the current map type id.
130+
*/
131+
getMapTypeId(): string;
132+
133+
/**
134+
* Sets the map type id.
135+
*/
136+
setMapTypeId(mapTypeId: string): void;
127137
}
128138
}
129139
declare namespace woosmap.map {
@@ -1204,10 +1214,6 @@ declare namespace woosmap.map {
12041214
* and when a details is successful.
12051215
*/
12061216
_sessionId: string;
1207-
/**
1208-
* Public getter to allow reading the value
1209-
*/
1210-
sessionId: string;
12111217
/**
12121218
* Contains methods related to retrieving autocomplete predictions, geocoding for localities and retrieving details
12131219
*/
@@ -1242,10 +1248,6 @@ declare namespace woosmap.map {
12421248
nearby(
12431249
request: woosmap.map.localities.LocalitiesNearbyRequest,
12441250
): Promise<woosmap.map.localities.LocalitiesNearbyResponse>;
1245-
1246-
search(
1247-
request: woosmap.map.localities.LocalitiesSearchRequest,
1248-
): Promise<woosmap.map.localities.LocalitiesSearchResponse>;
12491251
}
12501252
}
12511253
declare namespace woosmap.map {
@@ -1560,6 +1562,14 @@ declare namespace woosmap.map {
15601562
* The initial heading to start from.
15611563
*/
15621564
heading?: number;
1565+
/**
1566+
* Whether to display the map type control. Defaults to false.
1567+
*/
1568+
mapTypeControl?: boolean;
1569+
/**
1570+
* The initial map type. Defaults to `MapTypeId.ROADMAP`.
1571+
*/
1572+
mapTypeId?: string;
15631573
/**
15641574
* ```json
15651575
* [
@@ -2621,8 +2631,9 @@ declare namespace woosmap.map.stores {
26212631
page?: number;
26222632
/**
26232633
* Find stores nearby an encoded polyline and inside a defined radius.
2634+
* The polyline as string is expected to be a google-encoded polyline.
26242635
*/
2625-
polyline?: string | woosmap.map.LatLng[];
2636+
polyline?: string | woosmap.map.LatLng[] | woosmap.map.LatLngLiteral[];
26262637
/**
26272638
* Example: `query=name:'My cool store'|type:'click_and_collect'`
26282639
* Search query combining one or more search clauses.
@@ -3129,54 +3140,6 @@ declare namespace woosmap.map.localities {
31293140
types: string | string[];
31303141
}
31313142
}
3132-
declare namespace woosmap.map.localities {
3133-
interface LocalitiesSearchRequest {
3134-
/**
3135-
* The categories of points of interest to return. Multiple categories can be passed as an array of comma separated strings.
3136-
* Example: `categories=['tourism', 'education']`
3137-
*/
3138-
categories?: string | string[];
3139-
/**
3140-
* Used to filter over countries. Countries must be passed as an
3141-
* ISO 3166-1 Alpha-2 or Alpha-3 compatible country code.
3142-
*/
3143-
components: woosmap.map.localities.LocalitiesComponentRestrictions;
3144-
/**
3145-
* The categories of points of interest to exclude from results. Multiple categories can be passed as an array of comma separated strings.
3146-
* Example: `excluded_categories=['hospitality.hostel','hospitality.guest_house']`
3147-
*/
3148-
excluded_categories?: string | string[];
3149-
/**
3150-
* The types of suggestions to exclude.
3151-
* see available types to exclude [https://developers.woosmap.com/products/localities/search/#types](https://developers.woosmap.com/products/localities/search/#types)
3152-
*/
3153-
excluded_types?: string | string[];
3154-
/**
3155-
* The user entered input string.
3156-
*/
3157-
input: string;
3158-
/**
3159-
* The language code, using ISO 3166-1 Alpha-2 country codes,
3160-
* indicating in which language the results should be returned, if possible.
3161-
* If language is not supplied, the Localities service will use english as default language.
3162-
*/
3163-
language?: string;
3164-
/**
3165-
* The center of the search circle.
3166-
*/
3167-
location: woosmap.map.LatLng | woosmap.map.LatLngLiteral;
3168-
/**
3169-
* Define the distance in meters within which the API will return results.
3170-
* Default radius if this parameter is not set is 100 000.
3171-
*/
3172-
radius?: number;
3173-
/**
3174-
* Types of targeted items.
3175-
* Available values are `point_of_interest`, `address`, `locality`, `postal_code`, `admin_level`, `country`.
3176-
*/
3177-
types: string | string[];
3178-
}
3179-
}
31803143
declare namespace woosmap.map.localities {
31813144
/**
31823145
* A Localities Autocomplete response returned by the call to
@@ -3224,19 +3187,6 @@ declare namespace woosmap.map.localities {
32243187
results: woosmap.map.localities.LocalitiesNearbyResult[];
32253188
}
32263189
}
3227-
declare namespace woosmap.map.localities {
3228-
/**
3229-
* A Localities Search response returned by the call to
3230-
* `LocalitiesService.search` containing a
3231-
* list of `LocalitiesSearchResult`.
3232-
*/
3233-
interface LocalitiesSearchResponse {
3234-
/**
3235-
* The array of search results.
3236-
*/
3237-
results: woosmap.map.localities.LocalitiesSearchResult[];
3238-
}
3239-
}
32403190
declare namespace woosmap.map.localities {
32413191
/**
32423192
* Defines information about a Locality.
@@ -3670,46 +3620,6 @@ declare namespace woosmap.map.localities {
36703620
previous_page?: number;
36713621
}
36723622
}
3673-
declare namespace woosmap.map.localities {
3674-
/**
3675-
* The types of result returned by search.
3676-
*/
3677-
type LocalitiesSearchTypes =
3678-
| "point_of_interest"
3679-
| "address"
3680-
| "locality"
3681-
| "postal_code"
3682-
| "route"
3683-
| "admin_level"
3684-
| "country";
3685-
}
3686-
declare namespace woosmap.map.localities {
3687-
/**
3688-
* Defines information about a Search element.
3689-
*/
3690-
interface LocalitiesSearchResult {
3691-
/**
3692-
* An array containing the categories of the result if it's a point of interest.
3693-
*/
3694-
categories?: string[];
3695-
/**
3696-
* The description for the result.
3697-
*/
3698-
description?: string;
3699-
/**
3700-
* Contains a unique ID for each result. Please use this ID to give feedbacks on results.
3701-
*/
3702-
public_id: string;
3703-
/**
3704-
* The title for the result.
3705-
*/
3706-
title: string;
3707-
/**
3708-
* An array containing the types of the result.
3709-
*/
3710-
types: woosmap.map.localities.LocalitiesSearchTypes[];
3711-
}
3712-
}
37133623
declare namespace woosmap.map {
37143624
/**
37153625
* Summary feature response, part of DatasetsSearchResponse.
@@ -4033,6 +3943,17 @@ declare namespace woosmap.map {
40333943
defaultPolygonStrokeColor?: string;
40343944
}
40353945
}
3946+
declare namespace woosmap.map {
3947+
/**
3948+
* Identifiers for common map types.
3949+
* Specify these by value, or by using the constant's name.
3950+
* For example, `'roadmap'` or `woosmap.map.MapTypeId.ROADMAP`.
3951+
*/
3952+
enum MapTypeId {
3953+
HYBRID = "HYBRID",
3954+
ROADMAP = "ROADMAP",
3955+
}
3956+
}
40363957
declare namespace woosmap.map {
40373958
enum DirectionStatus {
40383959
OK = "OK",

types/woosmap.map/woosmap.map-tests.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Tests for Woosmap Map JS API v1.4
22
// https://developers.woosmap.com/products/map-api/get-started/
3+
//
34

45
/**
56
* Display a Map
@@ -21,6 +22,7 @@ const mapOptions = expectType({
2122
},
2223
],
2324
enableMarkerAccessibleNavigation: true,
25+
mapTypeId: woosmap.map.MapTypeId.ROADMAP,
2426
}) as woosmap.map.MapOptions;
2527
const map = new woosmap.map.Map(document.getElementById("mapContainer") as HTMLElement, mapOptions);
2628

@@ -48,6 +50,18 @@ map.remove();
4850
// $ExpectType MVCArray<MapType>
4951
map.overlayMapTypes;
5052

53+
/**
54+
* MapTypeId
55+
*/
56+
// $ExpectType MapTypeId.ROADMAP
57+
woosmap.map.MapTypeId.ROADMAP;
58+
// $ExpectType MapTypeId.HYBRID
59+
woosmap.map.MapTypeId.HYBRID;
60+
// $ExpectType string
61+
map.getMapTypeId();
62+
// $ExpectType void
63+
map.setMapTypeId(woosmap.map.MapTypeId.HYBRID);
64+
5165
/**
5266
* Marker
5367
*/
@@ -578,23 +592,6 @@ promiseLocalitiesNearby.then((result) => {
578592
// $ExpectType LocalitiesNearbyResponse
579593
result;
580594
});
581-
const localitiesSearchRequest = expectType({
582-
input: "royal al",
583-
types: ["point_of_interest", "address"],
584-
language: "EN",
585-
components: { country: ["GB", "FR"] },
586-
radius: 5000000,
587-
location: { lat: 51.5007, lng: -0.1246 },
588-
categories: ["tourism", "hospitality"],
589-
excluded_categories: "hospitality.hostel",
590-
excluded_types: ["admin_level", "village"],
591-
}) as woosmap.map.localities.LocalitiesSearchRequest;
592-
593-
const promiseLocalitiesSearch = localitiesService.search(localitiesSearchRequest);
594-
promiseLocalitiesSearch.then((result) => {
595-
// $ExpectType LocalitiesSearchResponse
596-
result;
597-
});
598595

599596
/**
600597
* Stores Service

0 commit comments

Comments
 (0)