diff --git a/ecc/scripts/scripts.js b/ecc/scripts/scripts.js index 472ad28e..7881fd77 100644 --- a/ecc/scripts/scripts.js +++ b/ecc/scripts/scripts.js @@ -75,27 +75,6 @@ export function decorateArea(area = document) { }); } -function getECCEnv(miloConfig) { - const { env } = miloConfig; - - if (env.name === 'prod') return 'prod'; - - if (env.name === 'stage') { - const { host, search } = window.location; - const usp = new URLSearchParams(search); - const eccEnv = usp.get('eccEnv'); - - if (eccEnv) return eccEnv; - - if (host.startsWith('main--')) return 'prod'; - if (host.startsWith('stage--') || host.startsWith('www.stage')) return 'stage'; - if (host.startsWith('dev--') || host.startsWith('www.dev')) return 'dev'; - } - - // fallback to dev - return 'dev'; -} - const locales = { '': { ietf: 'en-US', tk: 'jdq5hay.css' }, br: { ietf: 'pt-BR', tk: 'inq1xob.css' }, diff --git a/ecc/scripts/utils.js b/ecc/scripts/utils.js index 8c7f2697..d6c5a635 100644 --- a/ecc/scripts/utils.js +++ b/ecc/scripts/utils.js @@ -4,6 +4,20 @@ const { createTag } = await import(`${LIBS}/utils/utils.js`); let secretCache = []; +export function getECCEnv() { + const { host, search } = window.location; + const usp = new URLSearchParams(search); + const eccEnv = usp.get('eccEnv'); + + if (eccEnv) return eccEnv; + if (host.startsWith('dev--') || host.startsWith('www.dev')) return 'dev'; + if (host.startsWith('stage--') || host.startsWith('www.stage')) return 'stage'; + if (host.startsWith('main--') || host.endsWith === 'adobe.com') return 'prod'; + + // fallback to dev + return 'dev'; +} + export function getIcon(tag) { const img = document.createElement('img'); img.className = `icon icon-${tag}`;