diff --git a/README.md b/README.md index c7102be..b492cfe 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 34db591..ff37efb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.4.6", + "version": "4.4.7", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/package.json b/package.json index c71ecbe..cab052c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "radar-sdk-js", - "version": "4.4.6", + "version": "4.4.7", "description": "Web Javascript SDK for Radar, location infrastructure for mobile and web apps.", "homepage": "https://radar.com", "type": "module", diff --git a/src/api/search.ts b/src/api/search.ts index 2bc8165..29551fc 100644 --- a/src/api/search.ts +++ b/src/api/search.ts @@ -24,6 +24,7 @@ class SearchAPI { expandUnits, mailable, lang, + postalCode, } = params; // near can be provided as a string or Location object @@ -46,6 +47,7 @@ class SearchAPI { expandUnits, mailable, lang, + postalCode, }, requestId, }); diff --git a/src/types.ts b/src/types.ts index db0c145..c10c82a 100644 --- a/src/types.ts +++ b/src/types.ts @@ -377,6 +377,7 @@ export interface RadarAutocompleteParams { expandUnits?: boolean; mailable?: boolean; lang?: string; + postalCode?: string; } export interface RadarAutocompleteResponse extends RadarResponse { diff --git a/src/ui/autocomplete.ts b/src/ui/autocomplete.ts index 79bf13b..aa090e2 100644 --- a/src/ui/autocomplete.ts +++ b/src/ui/autocomplete.ts @@ -247,7 +247,7 @@ class AutocompleteUI { } public async fetchResults(query: string) { - const { limit, layers, countryCode, expandUnits, mailable, onRequest } = this.config; + const { limit, layers, countryCode, expandUnits, mailable, lang, postalCode, onRequest } = this.config; const params: RadarAutocompleteParams = { query, @@ -256,6 +256,8 @@ class AutocompleteUI { countryCode, expandUnits, mailable, + lang, + postalCode, } if (this.near) { @@ -507,14 +509,22 @@ class AutocompleteUI { return this; } - public setWidth(width: number | string) { - this.config.width = width; + public setWidth(width: number | string | null) { + if (width === null) { + this.config.width = undefined; + } else if (typeof width === 'string' || typeof width === 'number') { + this.config.width = width; + } setWidth(this.wrapper, this.config); return this; } - public setMaxHeight(height: number | string) { - this.config.maxHeight = height; + public setMaxHeight(height: number | string | null) { + if (height === null) { + this.config.maxHeight = undefined; + } else if (typeof height === 'string' || typeof height === 'number') { + this.config.maxHeight = height; + } setHeight(this.resultsList, this.config); return this; } @@ -530,6 +540,24 @@ class AutocompleteUI { return this; } + public setLang(lang: string | null) { + if (lang === null) { + this.config.lang = undefined; + } else if (typeof lang === 'string') { + this.config.lang = lang; + } + return this; + } + + public setPostalCode(postalCode: string | null) { + if (postalCode === null) { + this.config.postalCode = undefined; + } else if (typeof postalCode === 'string') { + this.config.postalCode = postalCode; + } + return this; + } + public setShowMarkers(showMarkers: boolean) { this.config.showMarkers = showMarkers; if (showMarkers) { diff --git a/src/version.ts b/src/version.ts index a67d18f..f0b1a81 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export default '4.4.6'; \ No newline at end of file +export default '4.4.7'; \ No newline at end of file