generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding feds block bootstraper for non milo
- Loading branch information
1 parent
3e11762
commit dc85274
Showing
4 changed files
with
140 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export default async function bootstrapBlock(miloConfigs, blockConfig) { | ||
const { miloLibs } = miloConfigs; | ||
const { name, targetEl } = blockConfig; | ||
const { setConfig, createTag, loadLink } = await import(`${miloLibs}/utils/utils.js`); | ||
setConfig({ ...miloConfigs }); | ||
const styles = [`${miloLibs}/blocks/${name}/${name}.css`, `${miloLibs}/navigation/styles.css`]; | ||
styles.forEach((url) => loadLink(url, { rel: 'stylesheet' })); | ||
const { default: initBlock } = await import(`${miloLibs}/blocks/${name}/${name}.js`); | ||
|
||
if (!document.querySelector(targetEl)) { | ||
const block = createTag(targetEl, { class: name }); | ||
document.body[blockConfig.appendType](block); | ||
} | ||
initBlock(document.querySelector(targetEl)); | ||
} |
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,25 @@ | ||
const blockConfig = { | ||
name: 'global-footer', | ||
targetEl: 'footer', | ||
appendType: 'appendChild', | ||
}; | ||
|
||
async function loadBlock() { | ||
const { fedsGlobalConfig = {} } = window; | ||
const miloLibs = fedsGlobalConfig.miloLibs || 'https://stage--milo--adobecom.hlx.page'; | ||
|
||
// 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, | ||
contentRoot: fedsGlobalConfig.contentRoot, | ||
miloLibs: `${miloLibs}/libs`, | ||
pathname: `/${fedsGlobalConfig.locale || ''}`, | ||
locales: fedsGlobalConfig.locales || locales, | ||
}; | ||
|
||
bootstrapBlock(clientConfig, blockConfig); | ||
} | ||
|
||
loadBlock(); |
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' }, | ||
}; |