From ef27e2939a0b4e195c6b772991b4ed468369fec8 Mon Sep 17 00:00:00 2001 From: Joaquin Rivero Date: Tue, 22 Oct 2024 04:09:24 +0800 Subject: [PATCH] getConfig() from milo --- acrobat/blocks/verb-widget/verb-widget.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/acrobat/blocks/verb-widget/verb-widget.js b/acrobat/blocks/verb-widget/verb-widget.js index 13c3c3b8..cd92fb28 100644 --- a/acrobat/blocks/verb-widget/verb-widget.js +++ b/acrobat/blocks/verb-widget/verb-widget.js @@ -4,7 +4,7 @@ import verbAnalytics from '../../scripts/alloy/verb-widget.js'; import createSvgElement from './icons.js'; const miloLibs = setLibs('/libs'); -const { createTag } = await import(`${miloLibs}/utils/utils.js`); +const { createTag, getConfig } = await import(`${miloLibs}/utils/utils.js`); const fallBack = 'https://www.adobe.com/go/acrobat-overview'; const EOLBrowserPage = 'https://acrobat.adobe.com/home/index-browser-eol.html'; @@ -36,14 +36,6 @@ const setUser = () => { localStorage.setItem('unity.user', 'true'); }; -const getLocale = () => { - const metaTag = document.querySelector('meta[property="og:locale"]'); - const localeString = metaTag ? metaTag.getAttribute('content') : 'en-US'; - const language = localeString.split('-')[0]; - const langPath = localeString === 'en-US' ? '' : `${language}/`; - return langPath; -}; - const setDraggingClass = (widget, shouldToggle) => { // eslint-disable-next-line chai-friendly/no-unused-expressions shouldToggle ? widget.classList.add('dragging') : widget.classList.remove('dragging'); @@ -87,9 +79,11 @@ export default async function init(element) { window.location.href = EOLBrowserPage; return; } - const langPath = getLocale(); - const ppURL = window.mph['verb-widget-privacy-policy-url'] || `https://www.adobe.com/${langPath}privacy/policy.html`; - const touURL = window.mph['verb-widget-terms-of-use-url'] || `https://www.adobe.com/${langPath}legal/terms.html`; + + const { locale } = getConfig(); + + const ppURL = window.mph['verb-widget-privacy-policy-url'] || `https://www.adobe.com${locale.prefix}/privacy/policy.html`; + const touURL = window.mph['verb-widget-terms-of-use-url'] || `https://www.adobe.com${locale.prefix}/legal/terms.html`; const children = element.querySelectorAll(':scope > div'); const VERB = element.classList[1];