@W-20276592: Address autocompletion feature#3484
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
- Implemented address autocomplete dropdown using mock addresses - Auto-fill address on choosing suggestion from dropdown - Added Google API integration - Sourced GCP API Key from Configuration API - Added ShopperConfigurations hook for API key management - Fixed accessibility, cleanup, and introduced caching by component - Added translations and various fixes
Signed-off-by: d.phan <d.phan@salesforce.com>
1854c3d to
0cc84e4
Compare
vcua-mobify
left a comment
There was a problem hiding this comment.
I'm new to this PR so apologies if the questions I'm asking have already been asked in the previous PRs.
| dnt: { | ||
| storageType: 'local', | ||
| key: 'dnt' | ||
| }, |
There was a problem hiding this comment.
What's the reason for the changes to auth.index.ts?
There was a problem hiding this comment.
@sf-mkosak mentioned that this was needed with the new SCAPI changes in updating to the latest commerce-sdk-isomorphic version
| const COUNTRY_CODE_MAP = { | ||
| USA: 'US', | ||
| Canada: 'CA' | ||
| } |
There was a problem hiding this comment.
Should this pull from the locales in config/sites.js?
I image that other projects with other countries will be updating this and the supported countries will be different depending on the site.
There was a problem hiding this comment.
I believe we had this conversation before while reviewing the original PR - had to make another PR due to CLA signature issues. In the current PWA Kit codebase, there is precedent for hard coding US / CA, regardless of sites.
There was a problem hiding this comment.
Thanks for reminding me of that! That was a while ago.
Since there was precedent for having hard coded country codes before this work, I won't treat this as a blocker for this release.
Is there a follow up ticket for eventually cleaning up the hard coded US / CA?
There was a problem hiding this comment.
We're adding an integration to Google API. But what if a project doesn't want to use Google?
Do we have docs explaining how customers can wire in other systems in place of Google?
There was a problem hiding this comment.
For now, the address autocompletion feature is only powered by Google Maps Platform, no plan to support other providers is in place. Customers will have to build their own implementation if they do not want address autocomplete with Google.
|
Just leaving a note here for tracking purposes: I discussed the PR with @dannyphan2000 since I could not get the address autocomplete to appear on my local. Currently on non-prod environments the call from ShopperConfigurations returns a null google api key. |
Signed-off-by: d.phan <d.phan@salesforce.com>
vcua-mobify
left a comment
There was a problem hiding this comment.
I've verified that with the most recent change, I can now set a custom Google API key via env var on local and see that the address autocomplete UI appears in checkout when filling in the address.
| return !platformProvidedKey | ||
| ? null | ||
| : getConfig()?.app?.googleCloudAPI?.apiKey || platformProvidedKey | ||
| return platformProvidedKey || null |
2eece5d
* @W-20276592: Address autocompletion feature - Implemented address autocomplete dropdown using mock addresses - Auto-fill address on choosing suggestion from dropdown - Added Google API integration - Sourced GCP API Key from Configuration API - Added ShopperConfigurations hook for API key management - Fixed accessibility, cleanup, and introduced caching by component - Added translations and various fixes * @W-20276592: clean up Signed-off-by: d.phan <d.phan@salesforce.com> * update API key rules Signed-off-by: d.phan <d.phan@salesforce.com> * quick fix Signed-off-by: d.phan <d.phan@salesforce.com> --------- Signed-off-by: d.phan <d.phan@salesforce.com>
Merging address autocompletion feature to develop branch.
See original PR: #3071
Description
Merging address autocompletion feature to develop branch. The changes included are from previously approved PRs.
#2614
#2767
#2886
#2981
#3209
Types of Changes
Changes
How to Test-Drive This PR
Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization