From 1330de89d8f36b6ef54d0b249d0368727c43b6cb Mon Sep 17 00:00:00 2001 From: Arshad Mohammed <87503056+arshadparwaiz@users.noreply.github.com> Date: Tue, 15 Aug 2023 13:43:25 -0700 Subject: [PATCH] MWPW-133172 - Add Floodgate option in Caas Configurator and Pass floodgate param to Caas (#913) Co-authored-by: armohamm Co-authored-by: Sunil Kamat <107644736+sukamat@users.noreply.github.com> Co-authored-by: Honwai Wong --- libs/blocks/caas-config/caas-config.js | 19 ++++++++-- libs/blocks/caas/utils.js | 35 +++++++++++++++++++ test/blocks/caas-config/caas-config.test.html | 4 +-- .../expectedConfigs/defaultConfig.js | 1 + test/blocks/caas/mocks/utils.js | 1 + test/blocks/caas/utils.test.js | 2 ++ 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/libs/blocks/caas-config/caas-config.js b/libs/blocks/caas-config/caas-config.js index 0664b9e873..7576c340d6 100644 --- a/libs/blocks/caas-config/caas-config.js +++ b/libs/blocks/caas-config/caas-config.js @@ -362,11 +362,11 @@ const UiPanel = () => html` `; const TagsPanel = ({ tagsData }) => { + const context = useContext(ConfiguratorContext); if (!tagsData) return ''; const contentTypeTags = getTagList(tagsData['content-type'].tags); const allTags = getTagTree(tagsData); - const context = useContext(ConfiguratorContext); const onLogicTagChange = (prop) => (values) => { context.dispatch({ @@ -646,6 +646,7 @@ const AdvancedPanel = () => { return html` + <${Input} label="Fetch Cards from Floodgate Content Tree" prop="fetchCardsFromFloodgateTree" type="checkbox" /> <${Input} label="Show IDs (only in the configurator)" prop="showIds" type="checkbox" /> <${Input} label="Do not lazyload" prop="doNotLazyLoad" type="checkbox" /> <${Input} label="Collection Size (defaults to Total Cards To Show)" prop="collectionSize" type="text" /> @@ -695,7 +696,9 @@ const getInitialState = () => { try { state = JSON.parse(lsState); /* c8 ignore next */ - } catch (e) {} + } catch (e) { + // Do nothing + } } } @@ -708,6 +711,16 @@ const saveStateToLocalStorage = (state) => { localStorage.setItem(LS_KEY, JSON.stringify(state)); }; +/** + * Removes the JSON key "fetchCardsFromFloodgateTree" from the Copied URL to Caas. + * Caas Collection will determine if the content should be served from floodgate + * based on metadata.xslx logic in caas-libs + * @param {*} key jsonKey + * @param {*} value jsonValue + * @returns replacedJson + */ +const fgKeyReplacer = (key, value) => (key === 'fetchCardsFromFloodgateTree' ? undefined : value); + /* c8 ignore start */ const CopyBtn = () => { const { state } = useContext(ConfiguratorContext); @@ -725,7 +738,7 @@ const CopyBtn = () => { const getUrl = () => { const url = window.location.href.split('#')[0]; - return `${url}#${utf8ToB64(JSON.stringify(state))}`; + return `${url}#${utf8ToB64(JSON.stringify(state, fgKeyReplacer))}`; }; const copyConfig = () => { diff --git a/libs/blocks/caas/utils.js b/libs/blocks/caas/utils.js index 012c9d3192..6da571de60 100644 --- a/libs/blocks/caas/utils.js +++ b/libs/blocks/caas/utils.js @@ -6,6 +6,7 @@ const URL_ENCODED_COMMA = '%2C'; const pageConfig = pageConfigHelper(); const pageLocales = Object.keys(pageConfig.locales || {}); +const requestHeaders = []; export function getPageLocale(currentPath, locales = pageLocales) { const possibleLocale = currentPath.split('/')[1]; @@ -272,6 +273,35 @@ export function getCountryAndLang({ autoCountryLang, country, language }) { }; } +/** + * Finds the matching tuple and returns its index. + * Looks for 'X-Adobe-Floodgate' in [['X-Adobe-Floodgate', 'pink'], ['a','b']] + * @param {*} fgHeader fgHeader + * @returns tupleIndex + */ +const findTupleIndex = (fgHeader) => { + const matchingTupleIndex = requestHeaders.findIndex((element) => element[0] === fgHeader); + return matchingTupleIndex; +}; + +/** + * Adds the floodgate header to the Config of ConsonantCardCollection + * headers: [['X-Adobe-Floodgate', 'pink'], ['OtherHeader', 'Value']] + * @param {*} state state + * @returns requestHeaders + */ +const addFloodgateHeader = (state) => { + const fgHeader = 'X-Adobe-Floodgate'; + const fgHeaderValue = 'pink'; + + // Delete FG header if already exists, before adding pink to avoid duplicates in requestHeaders + requestHeaders.splice(findTupleIndex(fgHeader, 1)); + if (state.fetchCardsFromFloodgateTree) { + requestHeaders.push([fgHeader, fgHeaderValue]); + } + return requestHeaders; +}; + export function arrayToObj(input = []) { const obj = {}; if (!Array.isArray(input)) { @@ -311,6 +341,8 @@ export const getConfig = async (originalState, strs = {}) => { const complexQuery = buildComplexQuery(state.andLogicTags, state.orLogicTags); + const caasRequestHeaders = addFloodgateHeader(state); + const config = { collection: { mode: state.theme, @@ -479,6 +511,7 @@ export const getConfig = async (originalState, strs = {}) => { lastViewedSession: state.lastViewedSession || '', }, customCard: ['card', `return \`${state.customCard}\``], + headers: caasRequestHeaders, }; return config; }; @@ -509,6 +542,7 @@ export const defaultState = { analyticsTrackImpression: false, andLogicTags: [], autoCountryLang: false, + fetchCardsFromFloodgateTree: false, bookmarkIconSelect: '', bookmarkIconUnselect: '', cardStyle: 'half-height', @@ -539,6 +573,7 @@ export const defaultState = { filtersCustom: [], filtersShowEmpty: false, gutter: '4x', + headers: [], hideCtaIds: [], includeTags: [], language: 'caas:language/en', diff --git a/test/blocks/caas-config/caas-config.test.html b/test/blocks/caas-config/caas-config.test.html index df2515504b..76f746d46e 100644 --- a/test/blocks/caas-config/caas-config.test.html +++ b/test/blocks/caas-config/caas-config.test.html @@ -274,7 +274,7 @@ copyBtn.click(); await delay(50); const copyTextArea = document.querySelector('.copy-text'); - expect(copyTextArea.value.split('#')[1]).to.equal('eyJhZGRpdGlvbmFsUmVxdWVzdFBhcmFtcyI6W10sImFuYWx5dGljc0NvbGxlY3Rpb25OYW1lIjoiIiwiYW5hbHl0aWNzVHJhY2tJbXByZXNzaW9uIjpmYWxzZSwiYW5kTG9naWNUYWdzIjpbXSwiYXV0b0NvdW50cnlMYW5nIjpmYWxzZSwiYm9va21hcmtJY29uU2VsZWN0IjoiIiwiYm9va21hcmtJY29uVW5zZWxlY3QiOiIiLCJjYXJkU3R5bGUiOiJoYWxmLWhlaWdodCIsImNhcmRUaXRsZUFjY2Vzc2liaWxpdHlMZXZlbCI6NiwiY29sbGVjdGlvbkJ0blN0eWxlIjoicHJpbWFy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UmFuZG9tU2FtcGxpbmciOmZhbHNlLCJzb3J0RXZlbnRTb3J0IjpmYWxzZSwic29ydEZlYXR1cmVkIjpmYWxzZSwic29ydE1vZGlmaWVkQXNjIjpmYWxzZSwic29ydE1vZGlmaWVkRGVzYyI6ZmFsc2UsInNvcnRSYW5kb20iOmZhbHNlLCJzb3J0UmVzZXJ2b2lyUG9vbCI6MTAwMCwic29ydFJlc2Vydm9pclNhbXBsZSI6Mywic29ydFRpdGxlQXNjIjpmYWxzZSwic29ydFRpdGxlRGVzYyI6ZmFsc2UsInNvdXJjZSI6WyJoYXdrcyJdLCJ0YWdzVXJsIjoid3d3LmFkb2JlLmNvbS9jaGltZXJhLWFwaS90YWdzIiwidGFyZ2V0QWN0aXZpdHkiOiIiLCJ0YXJnZXRFbmFibGVkIjpmYWxzZSwidGhlbWUiOiJsaWdodGVzdCIsImRldGFpbHNUZXh0T3B0aW9uIjoiZGVmYXVsdCIsInRpdGxlSGVhZGluZ0xldmVsIjoiaDMiLCJ0b3RhbENhcmRzVG9TaG93IjoxMCwidXNlTGlnaHRUZXh0IjpmYWxzZSwidXNlT3ZlcmxheUxpbmtzIjpmYWxzZSwiY29sbGVjdGlvbkJ1dHRvblN0eWxlIjoicHJpbWFyeSIsInVzZXJJbmZvIjpbXX0=') }); it('Clones an object', () => { @@ -295,7 +295,7 @@ }); it('Converts Base 64 to UTF-8', () => { - const hash = '#eyJjYXJkU3R5bGUiOiJmdWxsLWNhcmQiLCJjb2xsZWN0aW9uQnRuU3R5bGUiOiJwcmltYXJ5IiwiY29udGFpbmVyIjoiODNQZXJjZW50IiwiY291bnRyeSI6ImNhYXM6Y291bnRyeS91cyIsImNvbnRlbnRUeXBlVGFncyI6W10sImRpc2FibGVCYW5uZXJzIjpmYWxzZSwiZHJhZnREYiI6ZmFsc2UsImd1dHRlciI6IjR4IiwibGFuZ3VhZ2UiOiJjYWFzOmxhbmd1YWdlL2VuIiwibGF5b3V0VHlwZSI6IjN1cCIsImxvYWRNb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JsYXlMaW5rcyI6ZmFsc2UsImNvbGxlY3Rpb25CdXR0b25TdHlsZSI6InByaW1hcnkiLCJ1c2VySW5mbyI6W119'; window.location.hash = hash; const hashConfig = getHashConfig(); expect(hashConfig.cardStyle).to.equal('half-height'); diff --git a/test/blocks/caas-config/expectedConfigs/defaultConfig.js b/test/blocks/caas-config/expectedConfigs/defaultConfig.js index 78f7b67831..b1f6166cd7 100644 --- a/test/blocks/caas-config/expectedConfigs/defaultConfig.js +++ b/test/blocks/caas-config/expectedConfigs/defaultConfig.js @@ -37,6 +37,7 @@ const defaultConfig = { ctaAction: '_blank', additionalRequestParams: {}, }, + headers: [], hideCtaIds: [ '', ], diff --git a/test/blocks/caas/mocks/utils.js b/test/blocks/caas/mocks/utils.js index 106cc2e39f..45890ab7be 100644 --- a/test/blocks/caas/mocks/utils.js +++ b/test/blocks/caas/mocks/utils.js @@ -34,6 +34,7 @@ export const parseEncodedConfig = stub().returns({ fallbackEndpoint: '', featuredCards: [], gutter: '4x', + headers: [], hideCtaIds: [], language: 'caas:language/en', layoutType: '4up', diff --git a/test/blocks/caas/utils.test.js b/test/blocks/caas/utils.test.js index 3188eeba00..1406cd4cc0 100644 --- a/test/blocks/caas/utils.test.js +++ b/test/blocks/caas/utils.test.js @@ -192,6 +192,7 @@ describe('getConfig', () => { reservoir: { sample: 3, pool: 1000 }, }, featuredCards: ['a', 'b'], + headers: [], hideCtaIds: [''], filterPanel: { enabled: true, @@ -385,6 +386,7 @@ describe('getConfig', () => { reservoir: { sample: 3, pool: 1000 }, }, featuredCards: ['a', 'b'], + headers: [], hideCtaIds: [''], filterPanel: { enabled: true,