- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.5k
 
New Components - google_maps_platform #15512
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
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            4 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
This file was deleted.
      
      Oops, something went wrong.
      
    
  
        
          
          
            26 changes: 26 additions & 0 deletions
          
          26 
        
  components/google_maps_platform/actions/get-place-details/get-place-details.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import app from "../../google_maps_platform.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "google_maps_platform-get-place-details", | ||
| name: "Get Place Details", | ||
| description: "Retrieves detailed information for a specific place using its Place ID. [See the documentation](https://developers.google.com/maps/documentation/places/web-service/place-details)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| placeId: { | ||
| type: "string", | ||
| label: "Place ID", | ||
| description: "A textual identifier that uniquely identifies a place, returned from Search Places Action.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getPlaceDetails({ | ||
| $, | ||
| placeId: this.placeId, | ||
| }); | ||
| 
     | 
||
| $.export("$summary", `Retrieved details for Place ID ${this.placeId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            123 changes: 123 additions & 0 deletions
          
          123 
        
  components/google_maps_platform/actions/search-places/search-places.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| import { | ||
| LANGUAGE_CODE_OPTIONS, | ||
| PRICE_LEVEL_OPTIONS, | ||
| RANK_PREFERENCE_OPTIONS, | ||
| } from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import app from "../../google_maps_platform.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "google_maps_platform-search-places", | ||
| name: "Search Places", | ||
| description: "Searches for places based on location, radius, and optional filters like keywords, place type, or name. [See the documentation](https://developers.google.com/maps/documentation/places/web-service/text-search)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| textQuery: { | ||
| type: "string", | ||
| label: "Text Query", | ||
| description: "The text string on which to search, for example: \"restaurant\", \"123 Main Street\", or \"best place to visit in San Francisco\". The API returns candidate matches based on this string and orders the results based on their perceived relevance.", | ||
| }, | ||
| includedType: { | ||
| type: "string", | ||
| label: "Included Type", | ||
| description: "Restricts the results to places matching the specified type defined by [Table A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a). Only one type may be specified.", | ||
| optional: true, | ||
| }, | ||
| includePureServiceAreaBusinesses: { | ||
| type: "boolean", | ||
| label: "Include Pure Service Area Businesses", | ||
| description: "If set to `true`, the response includes businesses that visit or deliver to customers directly, but don't have a physical business location. If set to `false`, the API returns only businesses with a physical business location.", | ||
| optional: true, | ||
| }, | ||
| languageCode: { | ||
| type: "string", | ||
| label: "Language Code", | ||
| description: "The language in which to return results.", | ||
| options: LANGUAGE_CODE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| locationBias: { | ||
| type: "object", | ||
| label: "Location Bias", | ||
| description: "Specifies an area to search. This location serves as a bias which means results around the specified location can be returned, including results outside the specified area. [See the documentation](https://developers.google.com/maps/documentation/places/web-service/text-search#location-bias) for further information.", | ||
| optional: true, | ||
| }, | ||
| locationRestriction: { | ||
| type: "string", | ||
| label: "Location Restriction", | ||
| description: "Specifies an area to search. Results outside the specified area are not returned.", | ||
| optional: true, | ||
| }, | ||
| evOptions: { | ||
| type: "object", | ||
| label: "EV Options", | ||
| description: "Specifies parameters for identifying available electric vehicle (EV) charging connectors and charging rates. [See the documentation](https://developers.google.com/maps/documentation/places/web-service/text-search#evoptions) for further information.", | ||
| optional: true, | ||
| }, | ||
| minRating: { | ||
| type: "string", | ||
| label: "Min Rating", | ||
| description: "Restricts results to only those whose average user rating is greater than or equal to this limit. Values must be between 0.0 and 5.0 (inclusive) in increments of 0.5. For example: 0, 0.5, 1.0, ... , 5.0 inclusive. Values are rounded up to the nearest 0.5. For example, a value of 0.6 eliminates all results with a rating less than 1.0.", | ||
| optional: true, | ||
| }, | ||
                
      
                  michelle0927 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| openNow: { | ||
| type: "boolean", | ||
| label: "Open Now", | ||
| description: "If `true`, return only those places that are open for business at the time the query is sent. If `false`, return all businesses regardless of open status. Places that don't specify opening hours in the Google Places database are returned if you set this parameter to `false`.", | ||
| optional: true, | ||
| }, | ||
| priceLevels: { | ||
| type: "string[]", | ||
| label: "Price Levels", | ||
| description: "Restrict the search to places that are marked at certain price levels. The default is to select all price levels.", | ||
| options: PRICE_LEVEL_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| rankPreference: { | ||
| type: "string", | ||
| label: "Rank Preference", | ||
| description: "Specifies how the results are ranked in the response based on the type of query: For a categorical query such as \"Restaurants in New York City\", RELEVANCE (rank results by search relevance) is the default. You can set Rank Preference to RELEVANCE or DISTANCE (rank results by distance). For a non-categorical query such as \"Mountain View, CA\", it is recommended that you leave Rank Preference unset.", | ||
| options: RANK_PREFERENCE_OPTIONS, | ||
| optional: true, | ||
| }, | ||
| regionCode: { | ||
| type: "string", | ||
| label: "Region Code", | ||
| description: "The region code used to format the response, specified as a [two-character CLDR code](https://www.unicode.org/cldr/charts/46/supplemental/territory_language_information.html) value. This parameter can also have a bias effect on the search results.", | ||
| optional: true, | ||
| }, | ||
| strictTypeFiltering: { | ||
| type: "boolean", | ||
| label: "Strict Type Filtering", | ||
| description: "Used with the `Included Type` parameter. When set to `true`, only places that match the specified types specified by includeType are returned. When `false`, the default, the response can contain places that don't match the specified types.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.searchPlaces({ | ||
| $, | ||
| data: { | ||
| textQuery: this.textQuery, | ||
| includedType: this.includedType, | ||
| includePureServiceAreaBusinesses: this.includePureServiceAreaBusinesses, | ||
| languageCode: this.languageCode, | ||
| locationBias: parseObject(this.locationBias), | ||
| locationRestriction: this.locationRestriction, | ||
| evOptions: parseObject(this.evOptions), | ||
| minRating: this.minRating, | ||
| openNow: this.openNow, | ||
| priceLevels: parseObject(this.priceLevels), | ||
| rankPreference: this.rankPreference, | ||
| regionCode: this.regionCode, | ||
| strictTypeFiltering: this.strictTypeFiltering, | ||
| }, | ||
| }); | ||
| 
     | 
||
| const placeCount = response.places?.length || 0; | ||
| $.export("$summary", `Found ${placeCount} place(s)`); | ||
| 
     | 
||
| return response; | ||
| }, | ||
| }; | ||
        
          
          
            13 changes: 0 additions & 13 deletions
          
          13 
        
  components/google_maps_platform/app/google_maps_platform.app.ts
  
  
      
      
   
        
      
      
    This file was deleted.
      
      Oops, something went wrong.
      
    
  
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.