From af93c462eb31d33fef67be77c52cb964f267a6f4 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Tue, 26 Nov 2024 21:47:26 +0530 Subject: [PATCH 01/11] fix for overview tab hide in products page if no response from api --- blocks/page-tabs/page-tabs.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index 86b1ebbb6..ffc9b16fd 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -102,6 +102,10 @@ function hasSpecifications(productResponse) { return productResponse?.raw?.numattributes > 0; } +function hasOverview(productResponse) { + return productResponse?.raw?.numattributes > 0; +} + export default async function decorate(block) { const response = await getProductResponse(); let productResponse; @@ -157,6 +161,8 @@ export default async function decorate(block) { return hasProducts(productResponse); case 'product-details': return hasParts(productResponse); + case 'overview' : + return hasOverview(productResponse); default: return true; } From 227caa58a25c334f3d4adb3bb287c95f21d6e9e7 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Tue, 26 Nov 2024 21:58:53 +0530 Subject: [PATCH 02/11] lint issue fixed --- blocks/page-tabs/page-tabs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index ffc9b16fd..cb1549550 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -161,7 +161,7 @@ export default async function decorate(block) { return hasProducts(productResponse); case 'product-details': return hasParts(productResponse); - case 'overview' : + case 'overview': return hasOverview(productResponse); default: return true; From 373fd2a530539592281667f97c84f2412ea31d13 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Wed, 27 Nov 2024 17:47:53 +0530 Subject: [PATCH 03/11] validated for both api & content authoring for overview tab --- blocks/columns/columns.css | 4 ++-- blocks/columns/columns.js | 2 +- blocks/page-tabs/page-tabs.js | 8 +++++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/blocks/columns/columns.css b/blocks/columns/columns.css index d13b821bb..389725aa9 100644 --- a/blocks/columns/columns.css +++ b/blocks/columns/columns.css @@ -136,8 +136,8 @@ height: 100%; } -.columns-wrapper :is(.w-1\/2) { - width: 50%; +.columns-wrapper :is(.\!w-1\/2) { + width: 50% !important; } .columns-wrapper :is(.w-12) { diff --git a/blocks/columns/columns.js b/blocks/columns/columns.js index 540b3ba72..6d6444be0 100644 --- a/blocks/columns/columns.js +++ b/blocks/columns/columns.js @@ -154,7 +154,7 @@ export default function decorate(block) { const seventythirtyEl = picWrapper.parentElement ?.parentElement?.parentElement?.parentElement; if (seventythirtyEl.querySelector('img')) { - pic.querySelector('img').classList.add('block', 'w-1/2'); + pic.querySelector('img').classList.add('block', '!w-1/2'); } else { pic.querySelector('img').classList.add('block'); } diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index cb1549550..5daaf6a89 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -103,7 +103,13 @@ function hasSpecifications(productResponse) { } function hasOverview(productResponse) { - return productResponse?.raw?.numattributes > 0; + const classVerify = document.querySelector('.product-overview-container').children; + if(classVerify.length === 0 && productResponse?.raw?.numattributes === 0){ + return null; + } + else{ + return productResponse?.raw?.numattributes; + } } export default async function decorate(block) { From 4b769f1c8a8983d8f7c6d274e84d199e178134a9 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Wed, 27 Nov 2024 18:22:11 +0530 Subject: [PATCH 04/11] lint issues fixed --- blocks/page-tabs/page-tabs.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index 5daaf6a89..7de4d778c 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -104,12 +104,10 @@ function hasSpecifications(productResponse) { function hasOverview(productResponse) { const classVerify = document.querySelector('.product-overview-container').children; - if(classVerify.length === 0 && productResponse?.raw?.numattributes === 0){ + if (classVerify.length === 0 && productResponse?.raw?.numattributes === 0) { return null; } - else{ - return productResponse?.raw?.numattributes; - } + return productResponse?.raw?.numattributes; } export default async function decorate(block) { From a9fda71430bedbbe75bf3c9e9c0578a2058c6f3d Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Thu, 28 Nov 2024 16:01:46 +0530 Subject: [PATCH 05/11] fix for blue arrow removal in details page --- blocks/mini-teasers/mini-teasers.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blocks/mini-teasers/mini-teasers.js b/blocks/mini-teasers/mini-teasers.js index 3f05437fc..83b945ece 100644 --- a/blocks/mini-teasers/mini-teasers.js +++ b/blocks/mini-teasers/mini-teasers.js @@ -25,6 +25,12 @@ export default function decorate(block) { link.classList.add(...'text-base font-semibold text-danaherpurple-500'.split(' ')); if (link.href.endsWith('#RequestAQuote')) link.classList.add('show-modal-btn'); } + const hrefLinks = element.querySelectorAll('a'); + hrefLinks.forEach((hrefLink) => { + if (hrefLink.href.includes('/null.html')) { + hrefLink.remove(); + } + }); }); if (block.classList.contains('add-border')) block.classList.add(...'border-t border-b border-solid border-black'.split(' ')); decorateModals(block); From 2158704bed0ca52816baf19e8c53f7761beeb8d4 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Thu, 28 Nov 2024 23:06:56 +0530 Subject: [PATCH 06/11] fix for overview tab hide-validated with prod and col containers --- blocks/page-tabs/page-tabs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index 7de4d778c..30f573b6b 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -103,11 +103,11 @@ function hasSpecifications(productResponse) { } function hasOverview(productResponse) { - const classVerify = document.querySelector('.product-overview-container').children; + const classVerify = document.querySelector('.product-overview-container, .columns-container')?.children; if (classVerify.length === 0 && productResponse?.raw?.numattributes === 0) { return null; } - return productResponse?.raw?.numattributes; + return productResponse?.raw?.richlongdescription; } export default async function decorate(block) { From 5f3b5b23b8fab400d02c7c8bdf030be979a548d8 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Mon, 2 Dec 2024 12:12:35 +0530 Subject: [PATCH 07/11] fix for 1310 title issue and product overview tab issue --- blocks/page-tabs/page-tabs.js | 2 +- tools/importer/transformers/productHero.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index 30f573b6b..d88eb71a9 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -104,7 +104,7 @@ function hasSpecifications(productResponse) { function hasOverview(productResponse) { const classVerify = document.querySelector('.product-overview-container, .columns-container')?.children; - if (classVerify.length === 0 && productResponse?.raw?.numattributes === 0) { + if (classVerify.length === 0 && productResponse?.raw?.richlongdescription.length === 0) { return null; } return productResponse?.raw?.richlongdescription; diff --git a/tools/importer/transformers/productHero.js b/tools/importer/transformers/productHero.js index f87b24d51..6a0368258 100644 --- a/tools/importer/transformers/productHero.js +++ b/tools/importer/transformers/productHero.js @@ -23,7 +23,7 @@ const createProductHero = async (main, document, param, url) => { const product = main.querySelector('product-page'); if (product) { const productCells = [ - ['Product Hero'], + ['Product Not Found'], ]; const title = document.createElement('h1'); const titleVal = await getProductTitle(url, host); From 753350397ba2c33087af7e4dc7b5e7d5c41c46d8 Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Thu, 5 Dec 2024 14:21:14 +0530 Subject: [PATCH 08/11] reverted the code fix in converter file productHero --- blocks/page-tabs/page-tabs.js | 23 +++++++++++++++++++--- tools/importer/transformers/productHero.js | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index d88eb71a9..3f3563f94 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -103,10 +103,10 @@ function hasSpecifications(productResponse) { } function hasOverview(productResponse) { - const classVerify = document.querySelector('.product-overview-container, .columns-container')?.children; + /* const classVerify = document.querySelector('.product-overview-container, .columns-container')?.children; if (classVerify.length === 0 && productResponse?.raw?.richlongdescription.length === 0) { return null; - } + } */ return productResponse?.raw?.richlongdescription; } @@ -133,7 +133,22 @@ export default async function decorate(block) { element.scrollIntoView(); }, 5000); } else { - currentTab = tabSections[0].getAttribute('aria-labelledby'); + /*currentTab = hasOverview() ? tabSections[0].getAttribute('aria-labelledby') : + hasOverview() ? tabSections[1].getAttribute('aria-labelledby') : + tabSections[1].getAttribute('aria-labelledby');*/ + currentTab = tabSections[0] ? tabSections[0].getAttribute('aria-labelledby') : + tabSections[1] ? tabSections[1].getAttribute('aria-labelledby'): + tabSections[2].getAttribute('aria-labelledby'); + console.log(currentTab); + //currentTab = hasOverview() ? ( hasSpecifications() ? tabSections[1].getAttribute('aria-labelledby')) : tabSections[0].getAttribute('aria-labelledby'); + //console.log(currentTab); + //currentTab = tabSections[0].getAttribute('aria-labelledby'); + //console.log(currentTab); + /* tabSections.forEach((ctab, i) => { + if(i === index){ + tabSections[i].getAttribute('aria-labelledby'); + } + }); */ } } @@ -150,6 +165,7 @@ export default async function decorate(block) { const tabs = tabSections.map((tabSection) => { const tabName = tabSection.dataset.tabname; const tabId = tabSection.getAttribute('aria-labelledby'); + //console.log(tabId); const tabIconPath = tabSection.dataset.tabicon; const iconName = extractIconName(tabIconPath); return { name: tabName, id: tabId, icon: iconName }; @@ -191,6 +207,7 @@ export default async function decorate(block) { window.addEventListener('hashchange', () => { const currentTab = window.location.hash?.replace('#', '') || tabSections[0].getAttribute('.aria-labelledby'); + console.log(currentTab); if (!currentTab) return; const element = main.querySelector(`.page-tab[aria-labelledby="${currentTab}"]`); diff --git a/tools/importer/transformers/productHero.js b/tools/importer/transformers/productHero.js index 6a0368258..f87b24d51 100644 --- a/tools/importer/transformers/productHero.js +++ b/tools/importer/transformers/productHero.js @@ -23,7 +23,7 @@ const createProductHero = async (main, document, param, url) => { const product = main.querySelector('product-page'); if (product) { const productCells = [ - ['Product Not Found'], + ['Product Hero'], ]; const title = document.createElement('h1'); const titleVal = await getProductTitle(url, host); From c0f9817b91fde10cea95b85b5fa7d4be371efb9b Mon Sep 17 00:00:00 2001 From: lakshmithi Date: Fri, 6 Dec 2024 15:43:23 +0530 Subject: [PATCH 09/11] lint issues and console cleanup fix --- blocks/page-tabs/page-tabs.js | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index 3f3563f94..afa3c78d2 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -103,10 +103,6 @@ function hasSpecifications(productResponse) { } function hasOverview(productResponse) { - /* const classVerify = document.querySelector('.product-overview-container, .columns-container')?.children; - if (classVerify.length === 0 && productResponse?.raw?.richlongdescription.length === 0) { - return null; - } */ return productResponse?.raw?.richlongdescription; } @@ -133,22 +129,7 @@ export default async function decorate(block) { element.scrollIntoView(); }, 5000); } else { - /*currentTab = hasOverview() ? tabSections[0].getAttribute('aria-labelledby') : - hasOverview() ? tabSections[1].getAttribute('aria-labelledby') : - tabSections[1].getAttribute('aria-labelledby');*/ - currentTab = tabSections[0] ? tabSections[0].getAttribute('aria-labelledby') : - tabSections[1] ? tabSections[1].getAttribute('aria-labelledby'): - tabSections[2].getAttribute('aria-labelledby'); - console.log(currentTab); - //currentTab = hasOverview() ? ( hasSpecifications() ? tabSections[1].getAttribute('aria-labelledby')) : tabSections[0].getAttribute('aria-labelledby'); - //console.log(currentTab); - //currentTab = tabSections[0].getAttribute('aria-labelledby'); - //console.log(currentTab); - /* tabSections.forEach((ctab, i) => { - if(i === index){ - tabSections[i].getAttribute('aria-labelledby'); - } - }); */ + currentTab = tabSections[0].getAttribute('aria-labelledby'); } } @@ -165,7 +146,6 @@ export default async function decorate(block) { const tabs = tabSections.map((tabSection) => { const tabName = tabSection.dataset.tabname; const tabId = tabSection.getAttribute('aria-labelledby'); - //console.log(tabId); const tabIconPath = tabSection.dataset.tabicon; const iconName = extractIconName(tabIconPath); return { name: tabName, id: tabId, icon: iconName }; @@ -207,7 +187,6 @@ export default async function decorate(block) { window.addEventListener('hashchange', () => { const currentTab = window.location.hash?.replace('#', '') || tabSections[0].getAttribute('.aria-labelledby'); - console.log(currentTab); if (!currentTab) return; const element = main.querySelector(`.page-tab[aria-labelledby="${currentTab}"]`); From b8301df2735977b86cc42c8f6b6c705a53a81673 Mon Sep 17 00:00:00 2001 From: Dave Nichols Date: Mon, 16 Dec 2024 17:17:23 +0000 Subject: [PATCH 10/11] Added some code, so that if the overview doesn't exist then open specifications --- blocks/page-tabs/page-tabs.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/blocks/page-tabs/page-tabs.js b/blocks/page-tabs/page-tabs.js index afa3c78d2..e7410c852 100644 --- a/blocks/page-tabs/page-tabs.js +++ b/blocks/page-tabs/page-tabs.js @@ -168,6 +168,17 @@ export default async function decorate(block) { } }); + // Check if 'overview' tab exists + const hasOverviewTab = filteredTabs.some((tab) => tab.id === 'overview'); + + // Set currentTab to 'overview' if it exists, otherwise 'specifications' + currentTab = hasOverviewTab ? 'overview' : 'specifications'; + + // If 'overview' tab does not exist, reload the page with '#specifications' in the URL + if (!hasOverviewTab) { + window.location.hash = '#specifications'; + } + const navList = createTabList(filteredTabs, currentTab); // For Mobile View From 9aaf8bda52ac4f48e35d0dc8f1b3153f200f20c6 Mon Sep 17 00:00:00 2001 From: rgravitvl Date: Tue, 17 Dec 2024 10:30:45 +0530 Subject: [PATCH 11/11] fixed lint issues --- tools/importer/transformers/cardList.js | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/importer/transformers/cardList.js b/tools/importer/transformers/cardList.js index b311b3778..e888086c3 100644 --- a/tools/importer/transformers/cardList.js +++ b/tools/importer/transformers/cardList.js @@ -41,6 +41,7 @@ const URLS_TO_BLOCK_MAP = [ const createCardList = (main, document) => { const url = document.querySelector('[property="og:url"]')?.content; if (url) { + // eslint-disable-next-line max-len const blockName = URLS_TO_BLOCK_MAP.find((item) => url.endsWith(item.url) || url.includes(item.url))?.blockName; if (blockName) { const block = [[blockName], ['']];