From ea6fc9f5b64874f750586c6f581d43a2a7ebfe77 Mon Sep 17 00:00:00 2001 From: "Adolfo R. Brandes" Date: Wed, 6 May 2026 20:03:05 -0300 Subject: [PATCH] feat: translate STUDIO_BASE_URL to cmsBaseUrl in getConfig Mirrors edx-platform's SITE_CONFIG_TRANSLATION_MAP entry so legacy MFE callers reading getConfig().STUDIO_BASE_URL resolve against getSiteConfig().cmsBaseUrl. Co-Authored-By: Claude --- README.md | 2 +- src/platform/getConfig.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0750f10..65188da 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth'; The i18n and auth subpaths re-export frontend-base's existing implementations directly. `getConfig()` returns a Proxy that resolves UPPER_SNAKE_CASE keys against: -1. A curated translation table mirroring edx-platform's `SITE_CONFIG_TRANSLATION_MAP` (`SITE_NAME`, `BASE_URL`, `LMS_BASE_URL`, `LOGIN_URL`, `LOGOUT_URL`, `LOGO_URL → headerLogoImageUrl`, `ACCESS_TOKEN_COOKIE_NAME`, `LANGUAGE_PREFERENCE_COOKIE_NAME`, `USER_INFO_COOKIE_NAME`, `CSRF_TOKEN_API_PATH`, `REFRESH_ACCESS_TOKEN_API_PATH`, `SEGMENT_KEY`), reading the corresponding camelCase field from `getSiteConfig()`. +1. A curated translation table mirroring edx-platform's [`SITE_CONFIG_TRANSLATION_MAP`](https://github.com/openedx/edx-platform/blob/master/lms/djangoapps/mfe_config_api/views.py#L25), reading the corresponding camelCase field from `getSiteConfig()`. 2. `getSiteConfig().commonAppConfig` for everything else, which is where edx-platform's compatibility layer puts non-translated `MFE_CONFIG` values (`INDIGO_*`, plugin-specific keys, etc.). Unknown keys return `undefined`. The Proxy re-reads `getSiteConfig()` on every access, so it stays current under `mergeSiteConfig` updates. diff --git a/src/platform/getConfig.ts b/src/platform/getConfig.ts index b92057a..0a8b7e9 100644 --- a/src/platform/getConfig.ts +++ b/src/platform/getConfig.ts @@ -19,6 +19,7 @@ export const SITE_CONFIG_TRANSLATION_MAP: Record = { LOGIN_URL: 'loginUrl', LOGOUT_URL: 'logoutUrl', /* OptionalSiteConfig */ + STUDIO_BASE_URL: 'cmsBaseUrl', LOGO_URL: 'headerLogoImageUrl', ACCESS_TOKEN_COOKIE_NAME: 'accessTokenCookieName', LANGUAGE_PREFERENCE_COOKIE_NAME: 'languagePreferenceCookieName',