diff --git a/example/src/index.html b/example/src/index.html
index 554ee4c0..f1111eb1 100644
--- a/example/src/index.html
+++ b/example/src/index.html
@@ -3,7 +3,7 @@
React Geosuggest
-
+
diff --git a/module/Geosuggest.esm.js b/module/Geosuggest.esm.js
index d931fec5..fa5e06c3 100644
--- a/module/Geosuggest.esm.js
+++ b/module/Geosuggest.esm.js
@@ -1481,54 +1481,27 @@ var default_1$3 = /** @class */ (function (_super) {
if (!this.geocoder) {
return;
}
- if (suggestToGeocode.placeId &&
- !suggestToGeocode.isFixture &&
- this.placesService) {
- var options = {
- placeId: suggestToGeocode.placeId,
- sessionToken: this.sessionToken
- };
- if (this.props.placeDetailFields) {
- options.fields = ['geometry'].concat(this.props.placeDetailFields);
- }
- this.placesService.getDetails(options, function (results, status) {
- if (status === _this.googleMaps.places.PlacesServiceStatus.OK) {
- var gmaps = results;
- var location_1 = gmaps.geometry.location;
- var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: {
- lat: location_1.lat(),
- lng: location_1.lng()
- } });
- _this.sessionToken = new google.maps.places.AutocompleteSessionToken();
- if (_this.props.onSuggestSelect) {
- _this.props.onSuggestSelect(suggest);
- }
- }
- });
- }
- else {
- var options = {
- address: suggestToGeocode.label,
- bounds: this.props.bounds,
- componentRestrictions: this.props.country
- ? { country: this.props.country }
- : undefined,
- location: this.props.location
- };
- this.geocoder.geocode(options, function (results, status) {
- if (status === _this.googleMaps.GeocoderStatus.OK) {
- var gmaps = results[0];
- var location_2 = gmaps.geometry.location;
- var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: {
- lat: location_2.lat(),
- lng: location_2.lng()
- } });
- if (_this.props.onSuggestSelect) {
- _this.props.onSuggestSelect(suggest);
- }
+ var options = {
+ address: suggestToGeocode.label,
+ bounds: this.props.bounds,
+ componentRestrictions: this.props.country
+ ? { country: this.props.country }
+ : undefined,
+ location: this.props.location
+ };
+ this.geocoder.geocode(options, function (results, status) {
+ if (status === _this.googleMaps.GeocoderStatus.OK) {
+ var gmaps = results[0];
+ var location_1 = gmaps.geometry.location;
+ var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: {
+ lat: location_1.lat(),
+ lng: location_1.lng()
+ } });
+ if (_this.props.onSuggestSelect) {
+ _this.props.onSuggestSelect(suggest);
}
- });
- }
+ }
+ });
};
/**
* Render the view
diff --git a/module/Geosuggest.umd.js b/module/Geosuggest.umd.js
index 81c11d7d..28a617c9 100644
--- a/module/Geosuggest.umd.js
+++ b/module/Geosuggest.umd.js
@@ -1487,54 +1487,27 @@
if (!this.geocoder) {
return;
}
- if (suggestToGeocode.placeId &&
- !suggestToGeocode.isFixture &&
- this.placesService) {
- var options = {
- placeId: suggestToGeocode.placeId,
- sessionToken: this.sessionToken
- };
- if (this.props.placeDetailFields) {
- options.fields = ['geometry'].concat(this.props.placeDetailFields);
- }
- this.placesService.getDetails(options, function (results, status) {
- if (status === _this.googleMaps.places.PlacesServiceStatus.OK) {
- var gmaps = results;
- var location_1 = gmaps.geometry.location;
- var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: {
- lat: location_1.lat(),
- lng: location_1.lng()
- } });
- _this.sessionToken = new google.maps.places.AutocompleteSessionToken();
- if (_this.props.onSuggestSelect) {
- _this.props.onSuggestSelect(suggest);
- }
- }
- });
- }
- else {
- var options = {
- address: suggestToGeocode.label,
- bounds: this.props.bounds,
- componentRestrictions: this.props.country
- ? { country: this.props.country }
- : undefined,
- location: this.props.location
- };
- this.geocoder.geocode(options, function (results, status) {
- if (status === _this.googleMaps.GeocoderStatus.OK) {
- var gmaps = results[0];
- var location_2 = gmaps.geometry.location;
- var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: {
- lat: location_2.lat(),
- lng: location_2.lng()
- } });
- if (_this.props.onSuggestSelect) {
- _this.props.onSuggestSelect(suggest);
- }
+ var options = {
+ address: suggestToGeocode.label,
+ bounds: this.props.bounds,
+ componentRestrictions: this.props.country
+ ? { country: this.props.country }
+ : undefined,
+ location: this.props.location
+ };
+ this.geocoder.geocode(options, function (results, status) {
+ if (status === _this.googleMaps.GeocoderStatus.OK) {
+ var gmaps = results[0];
+ var location_1 = gmaps.geometry.location;
+ var suggest = __assign({}, suggestToGeocode, { gmaps: gmaps, location: {
+ lat: location_1.lat(),
+ lng: location_1.lng()
+ } });
+ if (_this.props.onSuggestSelect) {
+ _this.props.onSuggestSelect(suggest);
}
- });
- }
+ }
+ });
};
/**
* Render the view
diff --git a/src/Geosuggest.tsx b/src/Geosuggest.tsx
index ef469e47..003ac8ac 100644
--- a/src/Geosuggest.tsx
+++ b/src/Geosuggest.tsx
@@ -501,68 +501,34 @@ export default class extends React.Component {
return;
}
- if (
- suggestToGeocode.placeId &&
- !suggestToGeocode.isFixture &&
- this.placesService
- ) {
- const options: any = {
- placeId: suggestToGeocode.placeId,
- sessionToken: this.sessionToken
- };
-
- if (this.props.placeDetailFields) {
- options.fields = ['geometry', ...this.props.placeDetailFields];
- }
-
- this.placesService.getDetails(options, (results, status) => {
- if (status === this.googleMaps.places.PlacesServiceStatus.OK) {
- const gmaps = results;
- const location = gmaps.geometry.location;
- const suggest = {
- ...suggestToGeocode,
- gmaps,
- location: {
- lat: location.lat(),
- lng: location.lng()
- }
- };
+ const options: google.maps.GeocoderRequest = {
+ address: suggestToGeocode.label,
+ bounds: this.props.bounds,
+ componentRestrictions: this.props.country
+ ? {country: this.props.country}
+ : undefined,
+ location: this.props.location
+ };
- this.sessionToken = new google.maps.places.AutocompleteSessionToken();
- if (this.props.onSuggestSelect) {
- this.props.onSuggestSelect(suggest);
+ this.geocoder.geocode(options, (results, status) => {
+ if (status === this.googleMaps.GeocoderStatus.OK) {
+ const gmaps = results[0];
+ const location = gmaps.geometry.location;
+ const suggest = {
+ ...suggestToGeocode,
+ gmaps,
+ location: {
+ lat: location.lat(),
+ lng: location.lng()
}
- }
- });
- } else {
- const options: google.maps.GeocoderRequest = {
- address: suggestToGeocode.label,
- bounds: this.props.bounds,
- componentRestrictions: this.props.country
- ? {country: this.props.country}
- : undefined,
- location: this.props.location
- };
-
- this.geocoder.geocode(options, (results, status) => {
- if (status === this.googleMaps.GeocoderStatus.OK) {
- const gmaps = results[0];
- const location = gmaps.geometry.location;
- const suggest = {
- ...suggestToGeocode,
- gmaps,
- location: {
- lat: location.lat(),
- lng: location.lng()
- }
- };
+ };
- if (this.props.onSuggestSelect) {
- this.props.onSuggestSelect(suggest);
- }
+ if (this.props.onSuggestSelect) {
+ this.props.onSuggestSelect(suggest);
}
- });
- }
+ }
+ });
+
}
/**