LG-7720: IPP: PO Search SWR refactor and enhancements#7468
LG-7720: IPP: PO Search SWR refactor and enhancements#7468allthesignals merged 18 commits intomainfrom
Conversation
|
A lot of tension here around naming... switching around between: 1) In-Person-Locations to 2) PostOffices to 2) UspsLocations? Most naming is some format of "In-Person Location" or some derivation of In-Person Proofing... so let's go with that? Although "Post Office" is most accurate, it's a specific kind of Post Office, one that performs ID proofing... |
|
This Step component is more like an "InPersonLocationSelectionStep" rather than |
There was a problem hiding this comment.
Location should be renamed too?
There was a problem hiding this comment.
Seems like the wrong name... it's in Address form before it becomes a query for in person locations...
app/javascript/packages/document-capture/components/in-person-locations.tsx
Outdated
Show resolved
Hide resolved
|
A little confused by this failure: It's a lint step... Further: we need to duplicate/modify the IPP Rails test to get the full coverage needed (I think?) |
NavaTim
left a comment
There was a problem hiding this comment.
Would you post desktop/mobile screenshots or an animated GIF to compare w/ the mockup?
app/javascript/packages/document-capture/components/address-search.tsx
Outdated
Show resolved
Hide resolved
...vascript/packages/document-capture/components/in-person-location-post-office-search-step.tsx
Outdated
Show resolved
Hide resolved
@allthesignals Looks to me like a test for IE11 support.
Yeah, makes sense to consolidate the naming. |
That check is to help prevent the introduction of non-IE11-compatible JavaScript. It's flagging At least for the syntax, we can add the package to our existing allowlist of dependencies to be processed by Babel. I would also want to either test or check explicit support guarantees to see whether IE11 will work with it, in case it's relying on some other newer features. FWIW, IE11 support will conclude at the end of the month, so it may not be an issue starting in January. † Technically, |
I see. Diff might be: |
1082f35 to
9f7a41c
Compare
| return; | ||
| } | ||
| const addressCandidates = await request(ADDRESS_SEARCH_URL, { | ||
| const addressCandidates = await request<Location>(ADDRESS_SEARCH_URL, { |
There was a problem hiding this comment.
I changed the request library so that responses need to be typed
| <> | ||
| <br /> | ||
| {addressQuery.address} | ||
| </> |
There was a problem hiding this comment.
Todo: implement copy!
There was a problem hiding this comment.
Todo: implement copy!
Just to clarify, are you planning to do that here, or in a follow-up pull request?
| const transformKeys = (location: object, predicate = snakeCase) => { | ||
| const sendObject = {}; | ||
| Object.keys(location).forEach((key) => { | ||
| sendObject[snakeCase(key)] = location[key]; | ||
| sendObject[predicate(key)] = location[key]; | ||
| }); | ||
| return sendObject; |
There was a problem hiding this comment.
Refactor here improves the naming a bit so it's more generic
| const requestUspsLocations = async (address: LocationQuery): Promise<FormattedLocation[]> => { | ||
| const response = await request<PostOffice[]>(LOCATIONS_URL, { | ||
| method: 'post', | ||
| json: { address: transformKeys(address) }, | ||
| }); | ||
|
|
||
| return formatLocation(response); | ||
| }; |
There was a problem hiding this comment.
This is an extraction of "fetcher" logic from the previous hook for useEffect. This follows the pattern for SWR.
| const selectedLocation = locationData[id]; | ||
| const selectedLocation = locationResults![id]!; |
There was a problem hiding this comment.
This is not great because locationResults can potentially be null!
|
Hey @NavaTim — I've shortened this PR a little bit so that it's doing less... updating the PR description accordingly... |
| city: string; | ||
| state: string; | ||
| zipCode: string; | ||
| address: string; |
There was a problem hiding this comment.
Added so that we can use the full address in messages
| {arcgisSearchEnabled && ( | ||
| <AddressSearch onAddressFound={handleFoundAddress} registerField={registerField} /> |
There was a problem hiding this comment.
This is redundant due to this PR, so removed it.
| poste américain proche. | ||
| search_button: Chercher | ||
| search_button: Rechercher | ||
| none_found: |
There was a problem hiding this comment.
Awaiting corrected french translation here cc @kellular (lemme know if i'm wrong)
a3c6a0b to
c751036
Compare
There was a problem hiding this comment.
CC @kellular sorry, not sure how to read the translation doc for this... sounds like we're still trying to determine?
There was a problem hiding this comment.
This only existed in order to display on screen
b6b02f6 to
caeb20a
Compare
aduth
left a comment
There was a problem hiding this comment.
I found this difficult to test locally since I don't have credentials for the address geocoder. Is there a ticket where we plan to stub out a fake geocoder service? I assume once this becomes more generally available in the application we'd want the flow to be minimally functional for a default application configuration.
...vascript/packages/document-capture/components/in-person-location-post-office-search-step.tsx
Outdated
Show resolved
Hide resolved
...vascript/packages/document-capture/components/in-person-location-post-office-search-step.tsx
Outdated
Show resolved
Hide resolved
app/javascript/packages/document-capture/components/in-person-locations.tsx
Outdated
Show resolved
Hide resolved
...vascript/packages/document-capture/components/in-person-location-post-office-search-step.tsx
Show resolved
Hide resolved
NavaTim
left a comment
There was a problem hiding this comment.
The screenshots differ significantly from the mockup, particularly the bolded result text and the address showing after the button. Was the latter temporary?
| address_search_hint: 'Exemple : 1960 W Chelsea Ave Allentown PA 18104' | ||
| address_search_label: Entrez une adresse pour trouver un bureau de poste près de chez vous. | ||
| none_found: | ||
| none_found: Placeholder %{address} |
There was a problem hiding this comment.
Best to actually translate this before merging (or mark as draft for now) since this is what a user would see in production.
There was a problem hiding this comment.
I guess if there's an outstanding story it may be fine since this is behind a FF.
There was a problem hiding this comment.
Let me do some cleanup on the screenshots and styling. Thanks for checking that. One of those screenshots shows intermediate progress on this and needs updated.
There was a problem hiding this comment.
Updated screenshots.
|
🎫 Ticket
Link to the relevant ticket.
🛠 Summary of changes
Refactors much of the in-person-location component by:
Feature work:
👀 Screenshots
If relevant, include a screenshot or screen capture of the changes.
Before:
Initial load, blank page:
No results found (locally):
After:
Initial load (shows pilots):

No results found (in dev env):
