-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port this over to Places API (New)? #841
Comments
If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.@BenJackGill Thank you for opening this issue. 🙏
This is an automated message, feel free to ignore. |
@BenJackGill this package doesn't really interact with the Places API at all, it only loads the Google Maps JavaScript API in the browser. I don't think there is a way to choose the version of the places library that is used by the Maps API (i.e., when loading it via |
I think it does interact with the Places API when it loads the libraries. I am using this package for Places autocomplete, and I restrict my API credentials to only the APIs that need access (principle of least privilege). In doing so, for this package to work it requires access to both the Maps JavaScript API ( Here is my code that uses import { Loader } from "@googlemaps/js-api-loader";
const loader = new Loader({
apiKey: process.env.GCP_PLACES_API_KEY || "",
version: "weekly",
libraries: ["places"], // <--- Maybe this is where it uses Places API?
});
await loader.load();
autocompleteService = new google.maps.places.AutocompleteService();
sessionToken.value = new google.maps.places.AutocompleteSessionToken();
// More stuff here for autocomplete predictions I tried migrating from the old Places API to the new one by changing the API credential restriction from So my feature request was hoping to either get the new Maybe I am asking this in the wrong place? |
Ah, I see. Indeed, the 'places' library dependency of the maps API is still mostly using the older version of the places API. As far as I know, only the new I think these new classes are meant to supercede and eventually replace the PlacesService and related classes, but I tend to believe the two versions are going to coexist for quite a while. |
@BenJackGill Indeed, the line See the Get Started with Place class page to make sure you've enabled the Places API (New) on the project associated with your API key and you've added the new API to your list of restrictions applied to that key. If you're looking for the new Place Autocomplete you can use the widget provided as an HTML element here: https://developers.google.com/maps/documentation/javascript/place-autocomplete-new |
We use also the Places API for autocomplete with this library. We got contacted by Google who asked if we could move to the new Places API (new). Now we are waiting of the support by this library. |
If you want to move to Places API (new), you can just start by using the new |
I had a second crack at this today. What I found is you need 3 APIs turned on, they are Having said that I still couldn't complete the conversion because there are many missing TypeScript types for |
That's a good point. Can you point out the types that are missing or maybe open an issue in the repo for the |
Is your feature request related to a problem? Please describe.
I am looking for a npm package to use with Places API (New) (
places.googleapis.com
) as opposed to the original Places API (places-backend.googleapis.com
) which this package currently uses. I was hoping this one could be ported/copied/modified to work with the Places API (New).Describe the solution you'd like
New npm package for Places API (New) (
places.googleapis.com
) to be used on client browsers. Or change this one so it supports the new API.Describe alternatives you've considered
This package, but it does not work with the new API.
Additional context
None
The text was updated successfully, but these errors were encountered: