diff --git a/packages/config/src/api/site_info.ts b/packages/config/src/api/site_info.ts index 62d45248cd..11395ac381 100644 --- a/packages/config/src/api/site_info.ts +++ b/packages/config/src/api/site_info.ts @@ -16,6 +16,7 @@ type GetSiteInfoOpts = { context?: string featureFlags?: Record testOpts?: TestOptions + siteFeatureFlagPrefix: string } /** * Retrieve Netlify Site information, if available. @@ -35,6 +36,7 @@ export const getSiteInfo = async function ({ offline = false, testOpts = {}, featureFlags = {}, + siteFeatureFlagPrefix, }: GetSiteInfoOpts) { const { env: testEnv = false } = testOpts @@ -53,7 +55,7 @@ export const getSiteInfo = async function ({ } const promises = [ - getSite(api, siteId), + getSite(api, siteId, siteFeatureFlagPrefix), getAccounts(api), getAddons(api, siteId), getIntegrations({ siteId, testOpts, offline, useV2Endpoint, accountId }), @@ -79,7 +81,7 @@ export const getSiteInfo = async function ({ } const promises = [ - getSite(api, siteId), + getSite(api, siteId, siteFeatureFlagPrefix), getAccounts(api), getAddons(api, siteId), getIntegrations({ siteId, testOpts, offline }), @@ -96,13 +98,13 @@ export const getSiteInfo = async function ({ return { siteInfo, accounts, addons, integrations } } -const getSite = async function (api: NetlifyAPI, siteId: string) { +const getSite = async function (api: NetlifyAPI, siteId: string, siteFeatureFlagPrefix: string) { if (siteId === undefined) { return {} } try { - const site = await (api as any).getSite({ siteId }) + const site = await (api as any).getSite({ siteId, feature_flags: siteFeatureFlagPrefix }) return { ...site, id: siteId } } catch (error) { throwUserError(`Failed retrieving site data for site ${siteId}: ${error.message}. ${ERROR_CALL_TO_ACTION}`) diff --git a/packages/config/src/main.ts b/packages/config/src/main.ts index d3ffeaeb23..6b0eae32d7 100644 --- a/packages/config/src/main.ts +++ b/packages/config/src/main.ts @@ -25,8 +25,19 @@ import { getRedirectsPath, addRedirects } from './redirects.js' * `config` together with related properties such as the `configPath`. */ export const resolveConfig = async function (opts) { - const { cachedConfig, cachedConfigPath, host, scheme, packagePath, pathPrefix, testOpts, token, offline, ...optsA } = - addDefaultOpts(opts) as $TSFixMe + const { + cachedConfig, + cachedConfigPath, + host, + scheme, + packagePath, + pathPrefix, + testOpts, + token, + offline, + siteFeatureFlagPrefix, + ...optsA + } = addDefaultOpts(opts) as $TSFixMe // `api` is not JSON-serializable, so we cannot cache it inside `cachedConfig` const api = getApiClient({ token, offline, host, scheme, pathPrefix, testOpts }) @@ -62,6 +73,7 @@ export const resolveConfig = async function (opts) { siteId, accountId, mode, + siteFeatureFlagPrefix, offline, featureFlags, testOpts,