Skip to content

feat: override links in directory cards - #1279

Open
benlife5 wants to merge 8 commits into
mainfrom
directory-override-link
Open

feat: override links in directory cards#1279
benlife5 wants to merge 8 commits into
mainfrom
directory-override-link

Conversation

@benlife5

Copy link
Copy Markdown
Contributor

Adds a field to the directory grid to override links. When set to yes, an entity field selector is displayed. If a value is present for the selected entity field/constant value, then it will be used for the link. If there is no value, we will fallback to the standard url. Also adds a Normalize Link option when overriding.

This will be used to link certain locations in a directory to external pages. The directory config will be updated to include entities beyond the Yext Pages scope, and then those entities will have a field populated with their external url.

This PR also adds a field for testing, and wires a few props through the EntityFieldSelector that were inconsistently available.

Screen.Recording.2026-07-31.at.10.05.58.AM.mov

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5109c22f-d7c7-448e-ab8a-13b9229409fd

📥 Commits

Reviewing files that changed from the base of the PR and between 6cc2b97 and b18494f.

⛔ Files ignored due to path filters (1)
  • packages/visual-editor/src/components/testing/screenshots/EventSection/[tablet] version 26 props with entity values.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (29)
  • packages/visual-editor/locales/platform/cs/visual-editor.json
  • packages/visual-editor/locales/platform/da/visual-editor.json
  • packages/visual-editor/locales/platform/de/visual-editor.json
  • packages/visual-editor/locales/platform/en-GB/visual-editor.json
  • packages/visual-editor/locales/platform/en/visual-editor.json
  • packages/visual-editor/locales/platform/es/visual-editor.json
  • packages/visual-editor/locales/platform/et/visual-editor.json
  • packages/visual-editor/locales/platform/fi/visual-editor.json
  • packages/visual-editor/locales/platform/fr/visual-editor.json
  • packages/visual-editor/locales/platform/hr/visual-editor.json
  • packages/visual-editor/locales/platform/hu/visual-editor.json
  • packages/visual-editor/locales/platform/it/visual-editor.json
  • packages/visual-editor/locales/platform/ja/visual-editor.json
  • packages/visual-editor/locales/platform/lt/visual-editor.json
  • packages/visual-editor/locales/platform/lv/visual-editor.json
  • packages/visual-editor/locales/platform/nb/visual-editor.json
  • packages/visual-editor/locales/platform/nl/visual-editor.json
  • packages/visual-editor/locales/platform/pl/visual-editor.json
  • packages/visual-editor/locales/platform/pt/visual-editor.json
  • packages/visual-editor/locales/platform/ro/visual-editor.json
  • packages/visual-editor/locales/platform/sk/visual-editor.json
  • packages/visual-editor/locales/platform/sv/visual-editor.json
  • packages/visual-editor/locales/platform/tr/visual-editor.json
  • packages/visual-editor/locales/platform/zh-TW/visual-editor.json
  • packages/visual-editor/locales/platform/zh/visual-editor.json
  • packages/visual-editor/src/components/directory/DirectoryCard.tsx
  • packages/visual-editor/src/components/directory/DirectoryWrapper.tsx
  • packages/visual-editor/src/components/migrations/0079_directory_card_display_props.ts
  • starter/src/dev.config.ts
💤 Files with no reviewable changes (20)
  • packages/visual-editor/locales/platform/sk/visual-editor.json
  • packages/visual-editor/locales/platform/zh-TW/visual-editor.json
  • packages/visual-editor/locales/platform/sv/visual-editor.json
  • packages/visual-editor/locales/platform/et/visual-editor.json
  • packages/visual-editor/locales/platform/hu/visual-editor.json
  • packages/visual-editor/locales/platform/nl/visual-editor.json
  • packages/visual-editor/locales/platform/da/visual-editor.json
  • packages/visual-editor/locales/platform/it/visual-editor.json
  • packages/visual-editor/locales/platform/zh/visual-editor.json
  • packages/visual-editor/locales/platform/en/visual-editor.json
  • packages/visual-editor/locales/platform/pl/visual-editor.json
  • packages/visual-editor/locales/platform/es/visual-editor.json
  • packages/visual-editor/locales/platform/fi/visual-editor.json
  • packages/visual-editor/locales/platform/tr/visual-editor.json
  • packages/visual-editor/locales/platform/de/visual-editor.json
  • packages/visual-editor/locales/platform/ja/visual-editor.json
  • packages/visual-editor/locales/platform/fr/visual-editor.json
  • packages/visual-editor/locales/platform/pt/visual-editor.json
  • packages/visual-editor/locales/platform/en-GB/visual-editor.json
  • packages/visual-editor/locales/platform/nb/visual-editor.json
🚧 Files skipped from review as they are similar to previous changes (9)
  • packages/visual-editor/locales/platform/cs/visual-editor.json
  • packages/visual-editor/locales/platform/hr/visual-editor.json
  • packages/visual-editor/src/components/migrations/0079_directory_card_display_props.ts
  • starter/src/dev.config.ts
  • packages/visual-editor/src/components/directory/DirectoryWrapper.tsx
  • packages/visual-editor/src/components/directory/DirectoryCard.tsx
  • packages/visual-editor/locales/platform/lv/visual-editor.json
  • packages/visual-editor/locales/platform/lt/visual-editor.json
  • packages/visual-editor/locales/platform/ro/visual-editor.json

Walkthrough

Directory cards now support configurable link paths with optional slug normalization and visibility controls for address, hours, and phone sections. DirectoryWrapper exposes these as field mappings that resolve to card data while preserving existing card properties and slots. Entity field selectors now support locale-wide constant application and hidden requirements tooltips. A migration initializes link-override and contact-section display properties for existing cards and grids. Localized labels and guidance were added across 23 platform locales. Starter schema and test data now include an external directory child URL and Spanish pageset support.

Sequence Diagram(s)

sequenceDiagram
  participant Editor
  participant DirectoryWrapper
  participant DirectoryCard
  participant CardData
  Editor->>DirectoryWrapper: configure link override and visibility fields
  DirectoryWrapper->>CardData: normalize mapped values with defaults
  DirectoryWrapper->>DirectoryCard: pass resolved card data and slots
  DirectoryCard->>DirectoryCard: resolve override URL or entity URL
  DirectoryCard->>DirectoryCard: apply slug normalization if enabled
  DirectoryCard-->>DirectoryCard: render contact sections conditionally
  DirectoryCard-->>Editor: display card with configured link and sections
Loading

Possibly related PRs

Suggested reviewers: asanehisa, mkilpatrick

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: configurable link overrides for directory cards.
Description check ✅ Passed The description accurately explains link overrides, fallback behavior, normalization, external-page use, and related EntityFieldSelector changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch directory-override-link

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/visual-editor/src/components/directory/DirectoryCard.tsx (1)

273-332: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Resolve link overrides with the page/document locale and merged child document.

resolveComponentData(data.linkOverride, i18n.language, resolvedChild) can resolve the wrong language and can fall back to the link constant when the link is entity text embedded in a translatable object. Use streamDocument.locale || "en" for entity resolution and pass the merged child document used by the card’s child-scoped resolution.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/visual-editor/src/components/directory/DirectoryCard.tsx` around
lines 273 - 332, Update the link override resolution in the DirectoryCard
component to use streamDocument.locale || "en" instead of i18n.language, and
pass the merged child document from childDocumentContext rather than
resolvedChild. Preserve the existing normalization and URL fallback behavior.
🧹 Nitpick comments (2)
packages/visual-editor/locales/platform/cs/visual-editor.json (1)

430-430: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Use imperative Czech forms for action labels.

Change Přepsat odkaz to Přepište odkaz and Zobrazit telefonní číslo to Zobrazte telefonní číslo.

Proposed translation update
-    "overrideLink": "Přepsat odkaz",
+    "overrideLink": "Přepište odkaz",
...
-    "showPhoneNumber": "Zobrazit telefonní číslo",
+    "showPhoneNumber": "Zobrazte telefonní číslo",

Based on learnings, Czech Visual Editor translations should prefer imperative verb forms, such as Naplňte nádobu, instead of non-imperative forms.

Also applies to: 495-495

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/visual-editor/locales/platform/cs/visual-editor.json` at line 430,
Update the Czech Visual Editor translation values for overrideLink and the
related “Zobrazit telefonní číslo” entry to use imperative forms: “Přepište
odkaz” and “Zobrazte telefonní číslo”.

Source: Learnings

starter/src/dev.config.ts (1)

9286-9297: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fix "External Page Url" casing to match the "URL" convention used elsewhere.

The display name "External Page Url" at Line 9296 and Line 11867 uses mixed casing for "Url". Every other URL-typed field display name in this file uses the fully capitalized form "URL", for example "Website URL", "Menu URL", "Order URL", "Reservation URL", "Android App URL", and "Landing Page URL". Change "External Page Url" to "External Page URL" in both places for consistency.

✏️ Proposed fix
                 displayName: "External Page Url",
+                displayName: "External Page URL",
-    c_externalPageUrl: "External Page Url",
+    c_externalPageUrl: "External Page URL",

Also applies to: 11867-11867

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@starter/src/dev.config.ts` around lines 9286 - 9297, Update the displayName
for the c_externalPageUrl definitions to use “External Page URL” instead of
“External Page Url” in both occurrences, including the definition near the
second referenced location, while leaving their registry and type configuration
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/visual-editor/locales/platform/hr/visual-editor.json`:
- Line 430: Update the fields.overrideLink translation from cancel/ignore
wording to an accurate “Override Link” equivalent in all three affected files:
packages/visual-editor/locales/platform/hr/visual-editor.json lines 430-430
(Croatian), packages/visual-editor/locales/platform/lt/visual-editor.json lines
430-430 (Lithuanian), and
packages/visual-editor/locales/platform/lv/visual-editor.json lines 430-430
(Latvian).

In `@packages/visual-editor/locales/platform/ro/visual-editor.json`:
- Line 572: Correct the Romanian grammatical agreement in the
linkOverrideDirectoryTooltip translation by changing the feminine form referring
to URL-ul to the masculine form, using “va fi utilizat URL-ul directorului
generat” or the locale team’s approved equivalent.
- Line 430: Update the Romanian `overrideLink` translation to use the approved
override/replace wording for link paths, replacing the current “Ignore the link”
meaning while preserving the neighboring terminology for links.

In `@packages/visual-editor/src/components/directory/DirectoryWrapper.tsx`:
- Line 79: Update the directory template text flow so the value passed to pt()
is not pre-encoded by msg(), allowing the { entityType:
templateMetadata.entityTypeDisplayName } options at the call site to be applied
during interpolation. Adjust the related default-text definition and the pt()
call near the DirectoryWrapper render path while preserving the existing
displayed text and template metadata behavior.

---

Outside diff comments:
In `@packages/visual-editor/src/components/directory/DirectoryCard.tsx`:
- Around line 273-332: Update the link override resolution in the DirectoryCard
component to use streamDocument.locale || "en" instead of i18n.language, and
pass the merged child document from childDocumentContext rather than
resolvedChild. Preserve the existing normalization and URL fallback behavior.

---

Nitpick comments:
In `@packages/visual-editor/locales/platform/cs/visual-editor.json`:
- Line 430: Update the Czech Visual Editor translation values for overrideLink
and the related “Zobrazit telefonní číslo” entry to use imperative forms:
“Přepište odkaz” and “Zobrazte telefonní číslo”.

In `@starter/src/dev.config.ts`:
- Around line 9286-9297: Update the displayName for the c_externalPageUrl
definitions to use “External Page URL” instead of “External Page Url” in both
occurrences, including the definition near the second referenced location, while
leaving their registry and type configuration unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2a6a0176-4815-4782-aae9-14e055b9a664

📥 Commits

Reviewing files that changed from the base of the PR and between a6c28b5 and 0720220.

📒 Files selected for processing (34)
  • packages/visual-editor/locales/platform/cs/visual-editor.json
  • packages/visual-editor/locales/platform/da/visual-editor.json
  • packages/visual-editor/locales/platform/de/visual-editor.json
  • packages/visual-editor/locales/platform/en-GB/visual-editor.json
  • packages/visual-editor/locales/platform/en/visual-editor.json
  • packages/visual-editor/locales/platform/es/visual-editor.json
  • packages/visual-editor/locales/platform/et/visual-editor.json
  • packages/visual-editor/locales/platform/fi/visual-editor.json
  • packages/visual-editor/locales/platform/fr/visual-editor.json
  • packages/visual-editor/locales/platform/hr/visual-editor.json
  • packages/visual-editor/locales/platform/hu/visual-editor.json
  • packages/visual-editor/locales/platform/it/visual-editor.json
  • packages/visual-editor/locales/platform/ja/visual-editor.json
  • packages/visual-editor/locales/platform/lt/visual-editor.json
  • packages/visual-editor/locales/platform/lv/visual-editor.json
  • packages/visual-editor/locales/platform/nb/visual-editor.json
  • packages/visual-editor/locales/platform/nl/visual-editor.json
  • packages/visual-editor/locales/platform/pl/visual-editor.json
  • packages/visual-editor/locales/platform/pt/visual-editor.json
  • packages/visual-editor/locales/platform/ro/visual-editor.json
  • packages/visual-editor/locales/platform/sk/visual-editor.json
  • packages/visual-editor/locales/platform/sv/visual-editor.json
  • packages/visual-editor/locales/platform/tr/visual-editor.json
  • packages/visual-editor/locales/platform/zh-TW/visual-editor.json
  • packages/visual-editor/locales/platform/zh/visual-editor.json
  • packages/visual-editor/src/components/directory/DirectoryCard.tsx
  • packages/visual-editor/src/components/directory/DirectoryWrapper.tsx
  • packages/visual-editor/src/components/migrations/0079_directory_card_display_props.ts
  • packages/visual-editor/src/components/migrations/migrationRegistry.ts
  • packages/visual-editor/src/editor/YextEntityFieldSelector.tsx
  • packages/visual-editor/src/fields/EntityFieldSelectorField.test.tsx
  • packages/visual-editor/src/fields/EntityFieldSelectorField.tsx
  • starter/localData/dev-dm-city-stream__en__8932945.json
  • starter/src/dev.config.ts

Comment thread packages/visual-editor/locales/platform/hr/visual-editor.json Outdated
Comment thread packages/visual-editor/locales/platform/ro/visual-editor.json Outdated
Comment thread packages/visual-editor/locales/platform/ro/visual-editor.json Outdated
Comment thread packages/visual-editor/src/components/directory/DirectoryWrapper.tsx Outdated

@asanehisa asanehisa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

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.

4 participants