diff --git a/blocks/gmo-program-details/gmo-program-details.css b/blocks/gmo-program-details/gmo-program-details.css index 8623978..801d8c9 100644 --- a/blocks/gmo-program-details/gmo-program-details.css +++ b/blocks/gmo-program-details/gmo-program-details.css @@ -531,7 +531,7 @@ body { z-index: 1; position: absolute; text-align: center; - width: 100px; + width: 120px; padding: 2px 0; font: normal normal normal 12px/17px Adobe Clean; margin-left: 100px; diff --git a/blocks/gmo-program-details/gmo-program-details.js b/blocks/gmo-program-details/gmo-program-details.js index 2531bf5..738f03b 100644 --- a/blocks/gmo-program-details/gmo-program-details.js +++ b/blocks/gmo-program-details/gmo-program-details.js @@ -249,7 +249,7 @@ function buildHeader(program, queryVars) { const headerWrapper = document.createElement('div'); headerWrapper.classList.add('details-header-wrapper'); const date = program && program.launchDate ? `
` + - `Launch date${formatDate(program.launchDate)}
` : ""; + `Proposed Launch Date${formatDate(program.launchDate)}` : ""; const programName = program ? program.programName : queryVars.programName; const campaignName = program && program.campaignName ? '
' + program.campaignName + '
': ""; diff --git a/blocks/gmo-program-list/gmo-program-list.js b/blocks/gmo-program-list/gmo-program-list.js index 9b33187..927093f 100644 --- a/blocks/gmo-program-list/gmo-program-list.js +++ b/blocks/gmo-program-list/gmo-program-list.js @@ -17,7 +17,7 @@ const headerConfig = [ 'sortable': false }, { - 'name': 'Launch Date', + 'name': 'Proposed Launch Date', 'attribute': 'launch', 'sortable': true, 'type': 'date' diff --git a/blocks/gmo-redirect/gmo-redirect.css b/blocks/gmo-redirect/gmo-redirect.css new file mode 100644 index 0000000..e69de29 diff --git a/blocks/gmo-redirect/gmo-redirect.js b/blocks/gmo-redirect/gmo-redirect.js new file mode 100644 index 0000000..61228ba --- /dev/null +++ b/blocks/gmo-redirect/gmo-redirect.js @@ -0,0 +1,36 @@ +import { + readBlockConfig +} from '../../scripts/lib-franklin.js'; +/** + * + * @param {HTMLElement} block + */ + +export default async function decorate(block) { + // Takes a config name as a string to be used as a regex and redirects to the value's location. + // Groups can be named using (?...) and referenced in the redirect using {name} + // Example: + // regex1 | /share/(?[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}) + // redirect1 | https://experience.adobe.com/?repoId=delivery-p108396-e1046543.adobeaemcloud.com#/@wfadoberm/assets/contenthub/shares/{shareid} + const config = readBlockConfig(block); + const path = window.location.pathname + window.location.hash; + + for(let reg in config){ + if(reg.startsWith('regex')){ + const regex = new RegExp(config[reg]); + let redirect = config[reg.replace('regex', 'redirect')]; + const match = path.match(regex); + if(match){ + for(let key in match.groups){ + redirect = redirect.replace(`{${key}}`, match.groups[key]); + } + console.info('redirecting to', redirect); + window.location.href = redirect; + return; + } + } + } + block.innerHTML = ''; +} + + diff --git a/fstab.yaml b/fstab.yaml index 3ec528b..df07e08 100644 --- a/fstab.yaml +++ b/fstab.yaml @@ -6,5 +6,5 @@ folders: /share/: /share/default /qa/share/: /qa/share/default /collection/: /collection/default - /qa/collection/: /collection/default + /qa/collection/: /qa/collection/default diff --git a/scripts/assets.js b/scripts/assets.js index ee4f1f2..189af6a 100644 --- a/scripts/assets.js +++ b/scripts/assets.js @@ -41,15 +41,17 @@ async function getUnderdevelopmentIcon() { } /** - * Search Asset for programName and campaignName parameters. + * Search Asset for programName, campaignName, deliverableType parameters. * * @param {string} - Program Name. * @param {string} - Campaign Name. + * @param {string} - Deliverable Type + * @param {integer} - Image Width * @returns {Image } Resolves with image object. * @throws {Error} If an HTTP error or network error occurs. */ -export async function searchAsset(programName, campaignName, imageWidth = 80) { +export async function searchAsset(programName, campaignName, deliverableType = '', imageWidth = 80) { const adminConfig = await getAdminConfig(); const deliveryURL = await initDeliveryEnvironment(); @@ -69,6 +71,10 @@ export async function searchAsset(programName, campaignName, imageWidth = 80) { if (campaignName) { // Check if campaignName is not null facetFilters.push('gmo-campaignName :'+ campaignName); } + + if (deliverableType) { // Check if deliverableType is not null + facetFilters.push('gmo-deliverableType :'+ deliverableType); + } const data = { requests: [ {