Skip to content

Commit

Permalink
Bump version to 2.1.5, update request parameter validation, and enhan…
Browse files Browse the repository at this point in the history
…ce default request parameters in PlaceAutocomplete component
  • Loading branch information
alexpechkarev committed Jan 8, 2025
1 parent 432d4a4 commit 5f698e3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "places-autocomplete-svelte",
"license": "MIT",
"version": "2.1.4",
"version": "2.1.5",
"description": "A lightweight and customizable Svelte component for easy integration of Google Maps Places (New) Autocomplete in your Svelte/SvelteKit applications. Provides accessible autocomplete suggestions and detailed address retrieval.",
"keywords": [
"svelte",
Expand Down
1 change: 0 additions & 1 deletion src/lib/PlaceAutocomplete.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
// set request input
request.input = target.value;
console.log(request);
// attempt to get autocomplete suggestions
try {
Expand Down
5 changes: 4 additions & 1 deletion src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const requestParamsDefault: RequestParams = {
* Validate and cast request parameters
* @param requestParams
*/
export const validateRequestParams = (requestParams: RequestParams) => {
export const validateRequestParams = (requestParams: RequestParams|undefined) => {



Expand All @@ -119,6 +119,9 @@ export const validateRequestParams = (requestParams: RequestParams) => {
requestParams = {
input: String(''),
sessionToken: String(''),
includedRegionCodes: ['GB'],
language: 'en-GB',
region: 'GB',
};

return requestParams;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* https://developers.google.com/maps/documentation/javascript/reference/autocomplete-data
*/
export interface RequestParams {
input: string;
input?: string;
includedPrimaryTypes?: string[];
includedRegionCodes?: string[];
inputOffset?: number;
Expand Down Expand Up @@ -54,7 +54,7 @@ export interface Props {
// region?: string;
// The <input> HTML autocomplete attribute
autocompete?: AutoFill;
requestParams: RequestParams;
requestParams?: RequestParams;
onResponse: (e: Event) => void;
onError: (error: string) => void;
}

0 comments on commit 5f698e3

Please sign in to comment.