@W-18762700: Implemented address autocomplete dropdown using mock addresses#2614
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
dannyphan2000
left a comment
There was a problem hiding this comment.
See comments in the earlier PR: #2589
…ropriate locations
| @@ -0,0 +1,289 @@ | |||
| /* | |||
There was a problem hiding this comment.
this file should be under the same folder as useAddressFields.jsx
| @@ -0,0 +1,200 @@ | |||
| /* | |||
There was a problem hiding this comment.
file name = index.jsx, same with test file
| /* | ||
| * Copyright (c) 2021, salesforce.com, inc. | ||
| * All rights reserved. | ||
| * SPDX-License-Identifier: BSD-3-Clause |
There was a problem hiding this comment.
do not need this file for this PR, out of scope
| * @param {string} countryCode - Country code to filter addresses (e.g., 'US', 'UK', 'AU') | ||
| * @returns {Promise<Array>} Array of address suggestions | ||
| */ | ||
| export const getAddressSuggestions = async (input, countryCode) => { |
There was a problem hiding this comment.
why is these functions in the mock
There was a problem hiding this comment.
explore using hook/function
| address: '147 Broadway, New York, NY 10038, USA', | ||
| mainText: '147 Broadway', | ||
| secondaryText: 'New York, NY 10038, USA', | ||
| country: 'US' |
dannyphan2000
left a comment
There was a problem hiding this comment.
run: npm run lint:fix at project root
| @@ -0,0 +1,289 @@ | |||
| /* | |||
| * Copyright (c) 2021, salesforce.com, inc. | |||
There was a problem hiding this comment.
Rename test file useAddressFields.test.js
| return parsedFields | ||
| } | ||
|
|
||
| // Parse secondary text to extract city, state, and postal code |
There was a problem hiding this comment.
Use multi-line comment
| provinceOptions | ||
| } from '@salesforce/retail-react-app/app/components/forms/state-province-options' | ||
| import {SHIPPING_COUNTRY_CODES} from '@salesforce/retail-react-app/app/constants' | ||
| import {getAddressSuggestions} from '@salesforce/retail-react-app/app/utils/address-suggestions' // TODO: replace with the actual API call to the address service |
There was a problem hiding this comment.
From same file, why 2 lines are needed here for the import?
| */ | ||
| export const getAddressSuggestions = async (input, countryCode) => { | ||
| // Simulate API delay | ||
| await simulateDelay(300) |
There was a problem hiding this comment.
Can we put 300 as a CONSTANT in this file?
| * Simulates API delay similar to real Google Places API | ||
| * @param {number} delay - Delay in milliseconds | ||
| */ | ||
| const simulateDelay = (delay = 200) => { |
There was a problem hiding this comment.
Should we do 300 as DEFAULT instead
…rrent PR, will add back for next PR
3b45f3f to
47ef052
Compare
01ff2dc
into
SalesforceCommerceCloud:harshini-magesh.main-address-autocompletion
…resses (#2614) This PR implements Address Autocomplete functionality for checkout in the PWA Kit storefront.The implementation includes a mock address service that simulates the Google Places API, which can then be replaced with the actual API integration in the future.
…resses (#2614) This PR implements Address Autocomplete functionality for checkout in the PWA Kit storefront.The implementation includes a mock address service that simulates the Google Places API, which can then be replaced with the actual API integration in the future.



Description
This PR implements Address Autocomplete functionality for checkout in the PWA Kit storefront.The implementation includes a mock address service that simulates the Google Places API, which can then be replaced with the actual API integration in the future.
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