Repository navigation
feat: Get user's geolocation data through Web API's Geolocation - #2728
Merged
Merged
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Member
There was a problem hiding this comment.
Good job!
I left some comments along with the review.
- Should we wrap some logic under the deliveryPromise -> enabled flag?
- I imagine we don't have a VTEX API to set the postal code if we have geoCoordinates, right? It would be good to update the postal code in this case.
Contributor
Author
Yeah, we don't have it internally. Maybe we look into it on another task |
eduardoformiga
approved these changes
Mar 20, 2025
hellofanny
reviewed
Mar 20, 2025
| reference?: string | ||
| /** | ||
| * Address geoCoordinates | ||
| * Address geoCoordinates. [longitude, latitude] |
hellofanny
reviewed
Mar 20, 2025
Contributor
pedromtec
reviewed
Mar 21, 2025
| } | ||
| ) | ||
| } | ||
| }, []) |
Contributor
There was a problem hiding this comment.
This array should not have some dependencies?
Contributor
Author
hellofanny
approved these changes
Mar 21, 2025
pedromtec
approved these changes
Mar 21, 2025
3 tasks
hellofanny
pushed a commit
that referenced
this pull request
Mar 26, 2025
## What's the purpose of this pull request? This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. ## How it works? First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. ## How to test it? 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. ### Starters Deploy Preview vtex-sites/starter.store#720 ## References Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
Mar 27, 2025
## What's the purpose of this pull request? This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. ## How it works? First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. ## How to test it? 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. ### Starters Deploy Preview vtex-sites/starter.store#720 ## References Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
Mar 28, 2025
## What's the purpose of this pull request? This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. ## How it works? First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. ## How to test it? 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. ### Starters Deploy Preview vtex-sites/starter.store#720 ## References Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
Apr 8, 2025
## What's the purpose of this pull request? This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. ## How it works? First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. ## How to test it? 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. ### Starters Deploy Preview vtex-sites/starter.store#720 ## References Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
Apr 11, 2025
## What's the purpose of this pull request? This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. ## How it works? First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. ## How to test it? 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. ### Starters Deploy Preview vtex-sites/starter.store#720 ## References Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
Apr 22, 2025
This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. vtex-sites/starter.store#720 Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
May 8, 2025
This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. vtex-sites/starter.store#720 Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
pushed a commit
that referenced
this pull request
May 12, 2025
This PR adds logic to ask for user's geolocation data consent (by using the `getCurrentPosition` function), then if granted save it on current session. It also ensures getting geo coordinates from postal code and country data when validating the current session. The geo coordinates data will be used by the Delivery Zones API. First we verify if there is any `geoCoordinates` data on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session. 1. Using the `RegionModal`: - Click on `Set my location` and it will open the `RegionModal`. - Set any USA zip code (the starter store is using the USA locale); - After the store reload, check the IndexedDB for `geoCoordinates` data, it should be there both longitude and latitude. 2. Through Geolocation consent: - Navigate through the main pages (home, PDP and PLP). It should ask for geolocation consent; - After granted check the `ValidateSession` requests (Network tab) or inside the IndexedDB for the `session` data, `geoCoordinates` should have latitude and longitude data. vtex-sites/starter.store#720 Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation
lariciamota
added a commit
that referenced
this pull request
May 13, 2025
## What's the purpose of this pull request? Feature branch for the Delivery Promise feature - phase 1 (navigation based on shopper location). - #2708 - #2728 - #2739 - #2745 - #2749 - #2750 - #2768 - #2772 - #2775 - #2809 - #2817 - #2824 - #2835 ## How it works? ## How to test it? ### Starters Deploy Preview ## References - [Jira epic](https://vtex-dev.atlassian.net/browse/SFS-1696) ## Checklist - [ ] For documentation changes, ping `@Mariana-Caetano` to review and update (Or submit a doc request) - [ ] TODO: Request Doc for PopOver - [ ] TODO: Remind to run cms sync in the default account when the feature branch is merged since new section was added. (And add the new section in the admin!) --------- Co-authored-by: Lucas Feijó <[email protected]> Co-authored-by: Fanny Chien <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




What's the purpose of this pull request?
This PR adds logic to ask for user's geolocation data consent (by using the
getCurrentPositionfunction), then if granted save it on current session.It also ensures getting geo coordinates from postal code and country data when validating the current session.
The geo coordinates data will be used by the Delivery Zones API.
How it works?
First we verify if there is any
geoCoordinatesdata on the current session. If not, we ask for geolocation data consent then, if granted, we update the current session.How to test it?
RegionModal:Set my locationand it will open theRegionModal.geoCoordinatesdata, it should be there both longitude and latitude.ValidateSessionrequests (Network tab) or inside the IndexedDB for thesessiondata,geoCoordinatesshould have latitude and longitude data.Starters Deploy Preview
vtex-sites/starter.store#720
References
Geolocation Web API: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation