Skip to content

Commit

Permalink
getConfig() from milo
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquinrivero committed Oct 21, 2024
1 parent dc45f2f commit ef27e29
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions acrobat/blocks/verb-widget/verb-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit ef27e29

Please sign in to comment.