Skip to content

Conversation

@mkouzel-yext
Copy link
Contributor

@mkouzel-yext mkouzel-yext commented Nov 3, 2025

Updates the locator to derive the Get Directions link on result cards from the ref_listings field in the search response if present, otherwise fallback to the yextDisplayCoordinate. If that is also not present, don't display the get direction button.

Copies the logic in #846 to determine the URL.

J=WAT-5136
TEST=manual

Created a locator in the Krusty dev account (514581), which has some entities with ref_listings data pointing to simulated URLs. Confirmed that when the ref_listings field in the search response had a listingUrl for a GOOGLEMYBUSINESS publisher, the Get Directions button pointed to the listingUrl rather than the Google Maps one generated from the yextDisplayCoordinate field. Confirmed that when the ref_listings field was empty or did not have a GOOGLEMYBUSINESS publisher, the yextDisplayCoordinate field was used to generate the Get Direction URL instead.

jam:https://jam.dev/c/a41f5a6d-1491-4a7a-96aa-936766e204e6

Updates the locator to derive the Get Directions link on result cards from the ref_listings field in the search response if present, otherwise fallback to the yextDisplayCoordinate. If that is also not present, don't display the get direction button.

J=WAT-5136
TEST=manual

Created a locator in the Krusty dev account (514581), which has some entities with ref_listings data pointing to simulated URLs. Confirmed that when the ref_listings field in the search response had a listingUrl for a GOOGLEMYBUSINESS publisher, the Get Directions button pointed to the listingUrl rather than the Google Maps one generated from the yextDisplayCoordinate field. Confirmed that when the ref_listings field was empty or did not have a GOOGLEMYBUSINESS publisher, the yextDisplayCoordinate field was used to generate the Get Direction URL instead.

jam:https://jam.dev/c/a41f5a6d-1491-4a7a-96aa-936766e204e6
@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2025

Warning: Component files have been updated but no migrations have been added. See https://github.com/yext/visual-editor/blob/main/packages/visual-editor/src/components/migrations/README.md for more information.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

The Locator component's directions link generation has been refactored to use a getDirections utility function instead of a hard-coded Google Maps URL builder. The new implementation prioritizes building directions URLs from location listings when available, falling back to coordinates if needed. The Location interface has been extended with an optional ref_listings field of type ListingType[] to support this functionality. The component now imports getDirections and ListingType from the @yext/pages-components package, replacing the previous inline implementation.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: deriving the Get Directions link from ref_listings when available, which matches the core modification in the changeset.
Description check ✅ Passed The pull request description clearly explains the changes: updating the locator to derive Get Directions links from ref_listings with fallback to yextDisplayCoordinate, directly relates to the code changes shown in the summary.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch locator-use-ref_listings

Comment @coderabbitai help to get the list of available commands and usage tips.

@mkouzel-yext mkouzel-yext merged commit 068bd24 into main Nov 4, 2025
15 checks passed
@mkouzel-yext mkouzel-yext deleted the locator-use-ref_listings branch November 4, 2025 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants