Skip to content

feat: mapbox uses YEXT_MAPBOX_API_KEY#1227

Open
jwartofsky-yext wants to merge 5 commits into
mainfrom
removeMapboxAPIKeyProp
Open

feat: mapbox uses YEXT_MAPBOX_API_KEY#1227
jwartofsky-yext wants to merge 5 commits into
mainfrom
removeMapboxAPIKeyProp

Conversation

@jwartofsky-yext
Copy link
Copy Markdown
Contributor

Removes the "Api Key" prop from the Static Map Section and Mapbox Static Map components.

They now use the key from the environment variable.

If the key fails to load, the component will not appear on the live page.

Tested using local starter.

Removes the "Api Key" prop from the Static Map Section and
Mapbox Static Map components.

They now use the key from the environment variable.

If the key fails to load, the component will not appear on the
live page.

Tested using local starter.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 2, 2026

⚠️ Deleted Translation Keys Detected

🔤 Deleted Translation Keys

fields

Key Languages Removed
fields.apiKey cs,da de,en en-GB,es et,fi fr,hr hu,it ja,lt lv,nb nl,pl pt,ro sk,sv tr,zh zh-TW

staticMapEmptyStateAddApiKey

Key Languages Removed
staticMapEmptyStateAddApiKey cs,da de,en en-GB,es et,fi fr,hr hu,it ja,lt lv,nb nl,pl pt,ro sk,sv tr,zh zh-TW

@jwartofsky-yext jwartofsky-yext changed the title feat: Mapbox uses YEXT_MAPBOX_API_KEY instead of prop feat: mapbox uses YEXT_MAPBOX_API_KEY Jun 2, 2026
@jwartofsky-yext jwartofsky-yext marked this pull request as ready for review June 2, 2026 20:47
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

Warning

Review limit reached

@yext-bot, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 53 minutes and 57 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 18c8870d-7b15-456e-a8ac-bcffffa98602

📥 Commits

Reviewing files that changed from the base of the PR and between 5136a15 and dd8962f.

⛔ Files ignored due to path filters (1)
  • packages/visual-editor/src/components/testing/screenshots/PhotoGallerySection/[desktop] version 59 with showSectionHeading false.png is excluded by !**/*.png, !packages/visual-editor/src/components/testing/screenshots/**
📒 Files selected for processing (2)
  • packages/visual-editor/src/components/pageSections/StaticMapSection.tsx
  • packages/visual-editor/src/docs/components.md

Walkthrough

This PR removes the configurable Mapbox API key from the visual editor's MapboxStaticMap and StaticMapSection components, switching to environment variable-based configuration. The apiKey prop is removed from both components' type definitions and configurations. The static map now resolves its API token from YEXT_MAPBOX_API_KEY (or YEXT_EDIT_LAYOUT_MODE_MAPBOX_API_KEY when rendering in layout editor mode). Empty-state messaging updates across 25 locales reflect the change from "add API key" to "missing/failed to load API key". Tests and documentation are updated accordingly.

Sequence Diagram(s)

No additional sequence diagrams are generated; the primary interaction flow is already visualized in the hidden review stack.

Possibly related PRs

  • yext/visual-editor#864: Introduced the static map empty-state UI around staticMapEmptyStateAddApiKey, which this PR replaces with environment variable-based setup and new staticMapEmptyStateMissingApiKey messaging.
  • yext/visual-editor#1182: Previously refactored the MapboxStaticMap editor field schema for apiKey handling; this PR removes that field entirely in favor of environment configuration.

Suggested labels

create-dev-release

Suggested reviewers

  • benlife5
  • colton-demetriou
  • mkilpatrick
  • asanehisa
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: Mapbox now uses the YEXT_MAPBOX_API_KEY environment variable instead of requiring a prop.
Description check ✅ Passed The description is directly related to the changeset, explaining the removal of the API Key prop and the shift to environment variable usage, which aligns with all file modifications.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch removeMapboxAPIKeyProp

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/visual-editor/src/components/pageSections/StaticMapSection.test.tsx (1)

47-83: ⚡ Quick win

Keep a legacy-shaped fixture for the versioned migration cases.

These version: 10 cases now already use the post-migration prop shape, so migrate() no longer proves that old saved StaticMapSection data with data.apiKey is handled correctly. Keeping at least one v10 fixture in the legacy shape would preserve real migration coverage for existing layouts.

🤖 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/pageSections/StaticMapSection.test.tsx`
around lines 47 - 83, Add a legacy-shaped v10 fixture to the existing test cases
so migrate() actually validates handling of the old saved StaticMapSection shape
(data.apiKey). In StaticMapSection.test.tsx, add one test case with version: 10
whose document uses the legacy shape (e.g., document: { data: { apiKey:
"fixture-static-map-api-key" }, ...optional fields like yextDisplayCoordinate }
) and props similar to the other v10 cases (e.g., props: { liveVisibility: true
}). Ensure the new case name indicates it is the legacy v10 format so migrate()
coverage includes the old data.apiKey field.
🤖 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/sk/visual-editor.json`:
- Line 690: The translation for the key "staticMapEmptyStateMissingApiKey"
incorrectly uses wording that points to locale/location settings ("nastavenia
lokality"); update this Slovak value to instruct users to check the site
settings instead — replace the phrase "nastavenia lokality" with an appropriate
Slovak equivalent for "site settings" so the message mirrors the original
English intent while keeping the rest of the string unchanged.

In `@packages/visual-editor/src/components/contentBlocks/MapboxStaticMap.tsx`:
- Around line 78-89: The code looks up the preview iframe using
document.getElementById("preview-frame") which fails when this component runs
inside that iframe; instead detect when code is running inside the iframe (e.g.,
window.frameElement or window.parent !== window) and query the parent document
for the "preview-frame" element so the preview-frame element and its
contentDocument are found; update the logic around iframe (the iframe variable
and the conditional that checks iframe?.contentDocument and chooses
streamDocument._env.YEXT_EDIT_LAYOUT_MODE_MAPBOX_API_KEY) to use the parent
document lookup when inside the iframe so YEXT_EDIT_LAYOUT_MODE_MAPBOX_API_KEY
is correctly selected in MapboxStaticMap.tsx.

---

Nitpick comments:
In
`@packages/visual-editor/src/components/pageSections/StaticMapSection.test.tsx`:
- Around line 47-83: Add a legacy-shaped v10 fixture to the existing test cases
so migrate() actually validates handling of the old saved StaticMapSection shape
(data.apiKey). In StaticMapSection.test.tsx, add one test case with version: 10
whose document uses the legacy shape (e.g., document: { data: { apiKey:
"fixture-static-map-api-key" }, ...optional fields like yextDisplayCoordinate }
) and props similar to the other v10 cases (e.g., props: { liveVisibility: true
}). Ensure the new case name indicates it is the legacy v10 format so migrate()
coverage includes the old data.apiKey field.
🪄 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

Run ID: a7f3c788-2215-4db7-be59-e45a86197cc5

📥 Commits

Reviewing files that changed from the base of the PR and between bc3acac and 5136a15.

📒 Files selected for processing (30)
  • 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/contentBlocks/MapboxStaticMap.tsx
  • packages/visual-editor/src/components/pageSections/StaticMapSection.test.tsx
  • packages/visual-editor/src/components/pageSections/StaticMapSection.tsx
  • packages/visual-editor/src/docs/components.md
  • starter/localData/dev-location-stream__en__cbafb9cd1c3e63d9814e236ba9181377.json

"spacingDefaultLabel": "Predvolený",
"staticContent": "Statický obsah",
"staticMapEmptyStateAddApiKey": "Ak chcete zobraziť ukážku mapy, pridajte kľúč API",
"staticMapEmptyStateMissingApiKey": "Nepodarilo sa načítať YEXT_MAPBOX_API_KEY. Skontrolujte nastavenia lokality.",
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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use “site settings” here, not “locale/location settings”.

Line 690 changes the meaning of the English source: nastavenia lokality points users to locale/location settings instead of site settings, so the recovery step is misleading.

💬 Suggested wording
-  "staticMapEmptyStateMissingApiKey": "Nepodarilo sa načítať YEXT_MAPBOX_API_KEY. Skontrolujte nastavenia lokality.",
+  "staticMapEmptyStateMissingApiKey": "Nepodarilo sa načítať YEXT_MAPBOX_API_KEY. Skontrolujte nastavenia stránky.",
🤖 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/sk/visual-editor.json` at line 690,
The translation for the key "staticMapEmptyStateMissingApiKey" incorrectly uses
wording that points to locale/location settings ("nastavenia lokality"); update
this Slovak value to instruct users to check the site settings instead — replace
the phrase "nastavenia lokality" with an appropriate Slovak equivalent for "site
settings" so the message mirrors the original English intent while keeping the
rest of the string unchanged.

"spacingDefaultLabel": "Default",
"staticContent": "Static content",
"staticMapEmptyStateAddApiKey": "Add an API key to preview your map",
"staticMapEmptyStateMissingApiKey": "Failed to load YEXT_MAPBOX_API_KEY. Please check your Site Settings.",
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.

Maybe your site's advanced configuration since that's the label for the Storm page

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.

2 participants