generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
282 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export default async function bootstrapBlock(miloConfigs, blockConfig) { | ||
const { miloLibs } = miloConfigs; | ||
const { name, targetEl } = blockConfig; | ||
const { getConfig, setConfig, createTag, loadLink, loadScript } = await import(`${miloLibs}/utils/utils.js`); | ||
setConfig({ ...miloConfigs }); | ||
const { default: initBlock } = await import(`${miloLibs}/blocks/${name}/${name}.js`); | ||
|
||
const styles = [`${miloLibs}/blocks/${name}/${name}.css`, `${miloLibs}/navigation/navigation.css`]; | ||
styles.forEach((url) => loadLink(url, { rel: 'stylesheet' })); | ||
|
||
if (!document.querySelector(targetEl)) { | ||
const block = createTag(targetEl, { class: name }); | ||
document.body[blockConfig.appendType](block); | ||
} | ||
initBlock(document.querySelector(targetEl)); | ||
if (blockConfig.targetEl === 'footer') { | ||
const { loadPrivacy } = await import(`${miloLibs}/scripts/delayed.js`); | ||
setTimeout(() => { | ||
loadPrivacy(getConfig, loadScript); | ||
}, blockConfig.delay); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* Extracting the essential styles required for rendering the component independently */ | ||
.global-footer, .dialog-modal { | ||
font-family: 'Adobe Clean', adobe-clean, 'Trebuchet MS', sans-serif; | ||
line-height: 27px; | ||
color: #2c2c2c; | ||
word-wrap: break-word; | ||
-webkit-font-smoothing: antialiased; | ||
} | ||
|
||
.global-footer a, .dialog-modal a { | ||
text-decoration: none; | ||
} | ||
|
||
.dialog-modal a { | ||
color: #035FE6; | ||
} | ||
|
||
.global-footer img { | ||
max-width: 100%; | ||
height: auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const blockConfig = { | ||
footer: { | ||
name: 'global-footer', | ||
targetEl: 'footer', | ||
appendType: 'appendChild', | ||
}, | ||
}; | ||
|
||
const envMap = { | ||
prod: 'https://www.adobe.com', | ||
stage: 'https://www.stage.adobe.com', | ||
qa: 'https://feds--milo--adobecom.hlx.page', | ||
}; | ||
|
||
export default async function loadBlock(configs, customLib) { | ||
const { footer, locale, env = 'prod' } = configs || {}; | ||
const branch = new URLSearchParams(window.location.search).get('navbranch'); | ||
const miloLibs = branch ? `https://${branch}--milo--adobecom.hlx.page` : customLib || envMap[env]; | ||
|
||
// Relative path can't be used, as the script will run on consumer's app | ||
const { default: bootstrapBlock } = await import(`${miloLibs}/libs/navigation/bootstrapper.js`); | ||
const { default: locales } = await import(`${miloLibs}/libs/utils/locales.js`); | ||
const clientConfig = { | ||
origin: miloLibs, | ||
miloLibs: `${miloLibs}/libs`, | ||
pathname: `/${locale || ''}`, | ||
locales: configs.locales || locales, | ||
}; | ||
if (footer) { | ||
const { authoringPath, privacyId, privacyLoadDelay = 3000 } = footer; | ||
blockConfig.delay = privacyLoadDelay; | ||
bootstrapBlock({ ...clientConfig, contentRoot: authoringPath, privacyId }, blockConfig.footer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
export default { | ||
'': { ietf: 'en-US', tk: 'hah7vzn.css' }, | ||
ae_ar: { ietf: 'ar-AE', tk: 'lpk1hwn.css', dir: 'rtl' }, | ||
ae_en: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
africa: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
ar: { ietf: 'ar', tk: 'lpk1hwn.css', dir: 'rtl' }, | ||
ar_es: { ietf: 'es-AR', tk: 'hah7vzn.css' }, | ||
at: { ietf: 'de-AT', tk: 'hah7vzn.css' }, | ||
au: { ietf: 'en-AU', tk: 'hah7vzn.css' }, | ||
be_en: { ietf: 'en-BE', tk: 'hah7vzn.css' }, | ||
be_fr: { ietf: 'fr-BE', tk: 'hah7vzn.css' }, | ||
be_nl: { ietf: 'nl-BE', tk: 'qxw8hzm.css' }, | ||
bg: { ietf: 'bg-BG', tk: 'qxw8hzm.css' }, | ||
br: { ietf: 'pt-BR', tk: 'hah7vzn.css' }, | ||
ca_fr: { ietf: 'fr-CA', tk: 'hah7vzn.css' }, | ||
ca: { ietf: 'en-CA', tk: 'hah7vzn.css' }, | ||
ch_de: { ietf: 'de-CH', tk: 'hah7vzn.css' }, | ||
ch_fr: { ietf: 'fr-CH', tk: 'hah7vzn.css' }, | ||
ch_it: { ietf: 'it-CH', tk: 'hah7vzn.css' }, | ||
cl: { ietf: 'es-CL', tk: 'hah7vzn.css' }, | ||
cn: { ietf: 'zh-CN', tk: 'qxw8hzm' }, | ||
co: { ietf: 'es-CO', tk: 'hah7vzn.css' }, | ||
cr: { ietf: 'es-419', tk: 'hah7vzn.css' }, | ||
cy_en: { ietf: 'en-CY', tk: 'hah7vzn.css' }, | ||
cz: { ietf: 'cs-CZ', tk: 'qxw8hzm.css' }, | ||
de: { ietf: 'de-DE', tk: 'hah7vzn.css' }, | ||
dk: { ietf: 'da-DK', tk: 'qxw8hzm.css' }, | ||
ec: { ietf: 'es-419', tk: 'hah7vzn.css' }, | ||
ee: { ietf: 'et-EE', tk: 'qxw8hzm.css' }, | ||
eg_ar: { ietf: 'ar', tk: 'qxw8hzm.css', dir: 'rtl' }, | ||
eg_en: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
el: { ietf: 'el', tk: 'qxw8hzm.css' }, | ||
es: { ietf: 'es-ES', tk: 'hah7vzn.css' }, | ||
fi: { ietf: 'fi-FI', tk: 'qxw8hzm.css' }, | ||
fr: { ietf: 'fr-FR', tk: 'hah7vzn.css' }, | ||
gr_el: { ietf: 'el', tk: 'qxw8hzm.css' }, | ||
gr_en: { ietf: 'en-GR', tk: 'hah7vzn.css' }, | ||
gt: { ietf: 'es-419', tk: 'hah7vzn.css' }, | ||
hk_en: { ietf: 'en-HK', tk: 'hah7vzn.css' }, | ||
hk_zh: { ietf: 'zh-HK', tk: 'jay0ecd' }, | ||
hu: { ietf: 'hu-HU', tk: 'qxw8hzm.css' }, | ||
id_en: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
id_id: { ietf: 'id', tk: 'qxw8hzm.css' }, | ||
ie: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
il_en: { ietf: 'en-IL', tk: 'hah7vzn.css' }, | ||
il_he: { ietf: 'he', tk: 'qxw8hzm.css', dir: 'rtl' }, | ||
in_hi: { ietf: 'hi', tk: 'qxw8hzm.css' }, | ||
in: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
it: { ietf: 'it-IT', tk: 'hah7vzn.css' }, | ||
jp: { ietf: 'ja-JP', tk: 'dvg6awq' }, | ||
kr: { ietf: 'ko-KR', tk: 'qjs5sfm' }, | ||
kw_ar: { ietf: 'ar', tk: 'qxw8hzm.css', dir: 'rtl' }, | ||
kw_en: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
la: { ietf: 'es-LA', tk: 'hah7vzn.css' }, | ||
langstore: { ietf: 'en-US', tk: 'hah7vzn.css' }, | ||
lt: { ietf: 'lt-LT', tk: 'qxw8hzm.css' }, | ||
lu_de: { ietf: 'de-LU', tk: 'hah7vzn.css' }, | ||
lu_en: { ietf: 'en-LU', tk: 'hah7vzn.css' }, | ||
lu_fr: { ietf: 'fr-LU', tk: 'hah7vzn.css' }, | ||
lv: { ietf: 'lv-LV', tk: 'qxw8hzm.css' }, | ||
mena_ar: { ietf: 'ar', tk: 'qxw8hzm.css', dir: 'rtl' }, | ||
mena_en: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
mt: { ietf: 'en-MT', tk: 'hah7vzn.css' }, | ||
mx: { ietf: 'es-MX', tk: 'hah7vzn.css' }, | ||
my_en: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
my_ms: { ietf: 'ms', tk: 'qxw8hzm.css' }, | ||
ng: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
nl: { ietf: 'nl-NL', tk: 'qxw8hzm.css' }, | ||
no: { ietf: 'no-NO', tk: 'qxw8hzm.css' }, | ||
nz: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
pe: { ietf: 'es-PE', tk: 'hah7vzn.css' }, | ||
ph_en: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
ph_fil: { ietf: 'fil-PH', tk: 'qxw8hzm.css' }, | ||
pl: { ietf: 'pl-PL', tk: 'qxw8hzm.css' }, | ||
pr: { ietf: 'es-419', tk: 'hah7vzn.css' }, | ||
pt: { ietf: 'pt-PT', tk: 'hah7vzn.css' }, | ||
qa_ar: { ietf: 'ar', tk: 'qxw8hzm.css', dir: 'rtl' }, | ||
qa_en: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
ro: { ietf: 'ro-RO', tk: 'qxw8hzm.css' }, | ||
ru: { ietf: 'ru-RU', tk: 'qxw8hzm.css' }, | ||
sa_ar: { ietf: 'ar', tk: 'qxw8hzm.css', dir: 'rtl' }, | ||
sa_en: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
se: { ietf: 'sv-SE', tk: 'qxw8hzm.css' }, | ||
sg: { ietf: 'en-SG', tk: 'hah7vzn.css' }, | ||
si: { ietf: 'sl-SI', tk: 'qxw8hzm.css' }, | ||
sk: { ietf: 'sk-SK', tk: 'qxw8hzm.css' }, | ||
th_en: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
th_th: { ietf: 'th', tk: 'lqo2bst.css' }, | ||
tr: { ietf: 'tr-TR', tk: 'qxw8hzm.css' }, | ||
tw: { ietf: 'zh-TW', tk: 'jay0ecd' }, | ||
ua: { ietf: 'uk-UA', tk: 'qxw8hzm.css' }, | ||
uk: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
vn_en: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
vn_vi: { ietf: 'vi', tk: 'qxw8hzm.css' }, | ||
za: { ietf: 'en-GB', tk: 'hah7vzn.css' }, | ||
cis_en: { ietf: 'en', tk: 'rks2kng.css' }, | ||
cis_ru: { ietf: 'ru', tk: 'qxw8hzm.css' }, | ||
sea: { ietf: 'en', tk: 'hah7vzn.css' }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
test/blocks/fragment/mocks/federal/fragments/frag-a.plain.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div> | ||
<h4>Frag A, Loads Frag B</h4> | ||
<a href="/test/blocks/fragment/mocks/fragments/frag-b">Frag B link</a> | ||
</div> |
Oops, something went wrong.