diff --git a/creativecloud/blocks/sidenav/sidenav.js b/creativecloud/blocks/sidenav/sidenav.js index f82b24d8b..43d07537a 100644 --- a/creativecloud/blocks/sidenav/sidenav.js +++ b/creativecloud/blocks/sidenav/sidenav.js @@ -5,7 +5,7 @@ import '../../deps/merch-sidenav.js'; const CATEGORY_ID_PREFIX = 'categories/'; const TYPE_ID_PREFIX = 'types/'; -const getIdLeaf = (id) => (id?.substring(id.lastIndexOf('/') + 1) || id); +const getIdLeaf = (id) => (id?.substring(id.lastIndexOf('/') + 1) || id).toLowerCase(); const getCategories = (items, isMultilevel, mapCategories) => { const configuration = { manageTabIndex: true }; diff --git a/creativecloud/blocks/universal-promo-terms/universal-promo-terms.css b/creativecloud/blocks/universal-promo-terms/universal-promo-terms.css new file mode 100644 index 000000000..d878b768f --- /dev/null +++ b/creativecloud/blocks/universal-promo-terms/universal-promo-terms.css @@ -0,0 +1,9 @@ +@media (min-width: 900px) { + body .feds-topnav-wrapper { + border: 0; + } +} + +body .global-footer { + background: none; +} diff --git a/creativecloud/blocks/universal-promo-terms/universal-promo-terms.js b/creativecloud/blocks/universal-promo-terms/universal-promo-terms.js new file mode 100644 index 000000000..11debfd40 --- /dev/null +++ b/creativecloud/blocks/universal-promo-terms/universal-promo-terms.js @@ -0,0 +1,52 @@ +const OFFER_ID_API_BASE = 'https://aos.adobe.io/offers/'; +const SELECTOR_ID_API_BASE = 'https://aos.adobe.io/offers:search.selector'; +const STAGE_OFFER_ID_API_BASE = 'https://aos-stage.adobe.io/offers/'; +const STAGE_SELECTOR_ID_API_BASE = 'https://aos-stage.adobe.io/offers:search.selector'; +const API_KEY = 'universalPromoTerm'; +const SERVICE_PROVIDERS = 'PROMO_TERMS'; + +function getEnv(env) { + if (env) return env; + if (window.location.origin.hostname === 'www.adobe.com') return 'production'; + return 'stage'; +} + +async function getTermsHTML(params, el, env, search) { + const locationSearch = search ?? window.location.search; + let promoTerms; + if (!params.get('offer_selector_ids')) { + let fetchURL = `${env === 'stage' ? STAGE_OFFER_ID_API_BASE : OFFER_ID_API_BASE}${params.get('offer_id')}${locationSearch}`; + fetchURL += params.get('api_key') ? '' : `&api_key=${API_KEY}`; + fetchURL += params.get('service_providers') ? '' : `&service_providers=${SERVICE_PROVIDERS}`; + + const res = await fetch(fetchURL); + if (!res.ok) return false; + const json = await res.json(); + promoTerms = json[0]?.promo_terms; + } else { + let fetchURL = `${env === 'stage' ? STAGE_SELECTOR_ID_API_BASE : SELECTOR_ID_API_BASE}${locationSearch}`; + fetchURL += params.get('api_key') ? '' : `&api_key=${API_KEY}`; + fetchURL += params.get('service_providers') ? '' : `&service_providers=${SERVICE_PROVIDERS}`; + + const res = await fetch(fetchURL); + if (!res.ok) return false; + const json = await res.json(); + promoTerms = json[0]?.offers[0]?.promo_terms; + } + + if (!promoTerms || !promoTerms.header || !promoTerms.text) { + return false; + } + return `
${promoTerms.text}
+ + Adobe Firefly +
+Use simple prompts and generative AI to create anything you can imagine with the new Adobe Firefly web app. + From photorealistic portraits and fantasy creatures to text effects and fresh color palettes, the + possibilities + are pure magic. Now available for commercial use.
+ ++ + Adobe Firefly +
+Use simple prompts and generative AI to create anything you can imagine with the new Adobe Firefly web app. + From photorealistic portraits and fantasy creatures to text effects and fresh color palettes, the + possibilities + are pure magic. Now available for commercial use.
+ +