From 92bca6e282b457074be4f5fcfec91ecd2771bcbc Mon Sep 17 00:00:00 2001 From: wz914876 Date: Mon, 1 Jul 2024 16:56:06 +0530 Subject: [PATCH 01/11] [Bug] Icons disappear if you scroll up and down --- scripts/scripts-dev.js | 5 ++++- scripts/scripts.js | 2 +- tools/actions/convert/test/converter.test.js | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/scripts-dev.js b/scripts/scripts-dev.js index dfef256e7..374fe2265 100644 --- a/scripts/scripts-dev.js +++ b/scripts/scripts-dev.js @@ -128,7 +128,10 @@ export function scrollJumpMenuFixed(pageJumpMenuContainer) { pageJumpMenuContainer.classList.remove(...'[&_.page-jump-menu-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center'.split(' ')); } else { pageJumpMenuContainer.classList.remove(...'w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-jump-menu-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden'.split(' ')); - document.querySelectorAll('.page-jump-menu-container ul li')?.forEach((el) => el?.firstElementChild?.classList.remove('rounded-full')); + document.querySelectorAll('.page-jump-menu-container ul li')?.forEach((el) => { + el?.firstElementChild?.classList.remove('rounded-full'); + el?.firstElementChild?.querySelector('span.icon svg use')?.classList.remove('stroke-danaherpurple-500'); + }); pageJumpMenuContainer.classList.add(...'[&_.page-jump-menu-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center'.split(' ')); } } diff --git a/scripts/scripts.js b/scripts/scripts.js index c7cfd530f..845b434b4 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -1 +1 @@ -import{sampleRUM,loadHeader,loadFooter,decorateButtons,decorateIcons,decorateSections,decorateBlocks,decorateTemplateAndTheme,waitForLCP,loadBlocks,loadCSS,toClassName,getMetadata,createOptimizedPicture,loadBlock,decorateBlock}from"./lib-franklin.js";import{div,domEl,img}from"./dom-builder.js";const LCP_BLOCKS=["breadcrumb","product-hero","carousel","columns"];const TEMPLATE_LIST={blog:{templateName:"blog",dependencies:["./schema.js","../blocks/columns/columns.js","../blocks/social-media/social-media.js","../blocks/article-info/article-info.js"]},productdetail:{templateName:"productDetail",dependencies:["./commerce.js","./product-payload-builder.js","./schema.js"]},processstep:"processstep",topic:"topic",library:"library",info:"library"};TEMPLATE_LIST.news=TEMPLATE_LIST.blog;export function imageHelper(imageUrl,imageAlt,eager=false){if(imageUrl.indexOf(".scene7.com")>-1){return img({src:`${imageUrl}`,alt:imageAlt,loading:eager?"eager":"lazy",class:"mb-2 h-48 w-full object-cover"})}const cardImage=createOptimizedPicture(imageUrl,imageAlt,eager,[{width:"500"}]);cardImage.querySelector("img").className="mb-2 h-48 w-full object-cover";return cardImage}export function createOptimizedS7Picture(src,alt="",eager=false){if(src.startsWith("/is/image")||src.indexOf(".scene7.com")>-1){const picture=document.createElement("picture");picture.appendChild(img({src:`${src}?$danaher-mobile$`,fetchpriority:"high",alt:alt,loading:eager?"eager":"lazy"}));return picture}return img({src:src,alt:alt,loading:eager?"eager":"lazy"})}export function formatDateUTCSeconds(date,options={}){const dateObj=new Date(0);dateObj.setUTCSeconds(date);return dateObj.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric",...options})}export function generateUUID(){return Math.floor(1e3+Math.random()*9e3)}let originalOffset=0;export function scrollJumpMenuFixed(pageJumpMenuContainer){if(!originalOffset){const rectPageTabs=pageJumpMenuContainer.getBoundingClientRect();originalOffset=rectPageTabs.top}if(window.scrollY>originalOffset){pageJumpMenuContainer.classList.add(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-jump-menu-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));document.querySelector(".page-jump-menu-container.fixed ul")?.classList.add("shadow-none","rounded-none");document.querySelectorAll(".page-jump-menu-container.fixed ul li")?.forEach((el=>{el?.firstElementChild?.classList.add("rounded-full");el?.firstElementChild?.querySelector("span.icon svg use")?.classList.add("stroke-danaherpurple-500")}));document.querySelector('.page-jump-menu-container.fixed li[aria-selected="true"] a span.icon svg')?.classList.add("stroke-white");pageJumpMenuContainer.classList.remove(..."[&_.page-jump-menu-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}else{pageJumpMenuContainer.classList.remove(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-jump-menu-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));document.querySelectorAll(".page-jump-menu-container ul li")?.forEach((el=>el?.firstElementChild?.classList.remove("rounded-full")));pageJumpMenuContainer.classList.add(..."[&_.page-jump-menu-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}}let pageTabsOriginalOffset=0;export function scrollPageTabFixed(pageTabsContainer){if(!pageTabsOriginalOffset){const rectPageTabs=pageTabsContainer.getBoundingClientRect();pageTabsOriginalOffset=rectPageTabs.top}if(window.scrollY>pageTabsOriginalOffset){pageTabsContainer.classList.add(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-tabs-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));pageTabsContainer.classList.remove(..."[&_.page-tabs-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}else{pageTabsContainer.classList.remove(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-tabs-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));pageTabsContainer.classList.add(..."[&_.page-tabs-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}}export function makePublicUrl(url){const isProd=window.location.hostname.includes("lifesciences.danaher.com");try{const newURL=new URL(url,window.location.origin);if(isProd){if(newURL.pathname.endsWith(".html")){return newURL.pathname}newURL.pathname+=".html";return newURL.pathname}if(newURL.pathname.endsWith(".html")){newURL.pathname=newURL.pathname.slice(0,-5);return newURL.pathname}return newURL.pathname}catch(error){console.error("Invalid URL:",error);return url}}export function setJsonLd(data,name){const existingScript=document.head.querySelector(`script[data-name="${name}"]`);if(existingScript){existingScript.innerHTML=JSON.stringify(data);return}const script=document.createElement("script");script.type="application/ld+json";script.innerHTML=JSON.stringify(data);script.dataset.name=name;document.head.appendChild(script)}function setFavicon(){const faviconLink=document.querySelector("link[rel*='icon']")||document.createElement("link");faviconLink.type="image/x-icon";faviconLink.rel="shortcut icon";faviconLink.href=`https://${window.location.hostname}/favicon.ico`;document.getElementsByTagName("head")[0].appendChild(faviconLink)}export async function getFragmentFromFile(url){const response=await fetch(url);if(!response.ok){console.error("error loading fragment details",response);return null}const text=await response.text();if(!text){console.error("fragment details empty",url);return null}return text}export function getCookie(cname){let value=decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(cname).replace(/[\\-\\.\\+\\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null;if(value&&(value.substring(0,1)==="{"&&value.substring(value.length-1,value.length)==="}"||value.substring(0,1)==="["&&value.substring(value.length-1,value.length)==="]")){try{value=JSON.parse(value)}catch(e){return value}}return value}export function isOTEnabled(){const otCookie=getCookie("OptanonConsent");if(typeof otCookie==="string"){return otCookie.includes("C0002:1")}return true}export function setCookie(cname,cvalue,expTime=30*1e3*60*60*24,path="/"){const today=new Date;today.setTime(today.getTime()+expTime);const expires="expires=".concat(today.toGMTString());const cookieString=cname.concat("=").concat(cvalue).concat(";").concat(expires).concat(";path=").concat(path);document.cookie=cookieString}async function buildVideo(main){const videoLinks=main.querySelectorAll('a[href*="youtube.com"],a[href*="vimeo.com"],a[href*="vidyard.com"]');if(videoLinks.length>0){const{default:decorateEmbed}=await import("../blocks/embed/embed.js");videoLinks.forEach((link=>{if(link.closest(".embed, .hero")==null){decorateEmbed(link.parentNode)}}))}}async function loadFonts(){await loadCSS(`${window.hlx.codeBasePath}/styles/fonts.css`);try{if(!window.location.hostname.includes("localhost"))sessionStorage.setItem("fonts-loaded","true")}catch(e){}}function loadBreadCrumb(){const header=document.querySelector("header");const breadcrumb=document.createElement("breadcrumb");if(window.location.pathname!=="/")header.after(breadcrumb)}function loadMobileMenu(){const breadcrumb=document.querySelector("breadcrumb");const mobileMunu=document.createElement("mobilemenu");const url=new URL(window.location.href);if(url.pathname.match(/\/us\/en\/products\/(family\/|sku\/|bundles\/)/)||url.pathname.match(/\/us\/en\/solutions\//)){breadcrumb.after(mobileMunu)}}function buildAutoBlocks(main){try{buildVideo(main)}catch(error){console.error("Auto Blocking failed",error)}}export function decorateModals(main){const ctaModalButton=main.querySelector(".show-modal-btn");const content=()=>ctaModalButton.getAttribute("data-dialog-message")?ctaModalButton.getAttribute("dialog-message"):"";ctaModalButton?.addEventListener("click",(async e=>{e.preventDefault();const{default:getModal}=await import("./modal.js");const customModal=await getModal("custom-modal",content,(modal=>{modal.querySelector('p[name="close"]')?.addEventListener("click",(()=>modal.close()))}));customModal.showModal()}))}function decorateTwoColumnSection(main){main.querySelectorAll(".section.container-two-col").forEach((section=>{const defaultContentWrappers=section.querySelectorAll(":scope > .default-content-wrapper");defaultContentWrappers.forEach((contentWrapper=>{[...contentWrapper.children].forEach((child=>{section.appendChild(child)}));let nextElement=contentWrapper.nextSibling;const allBlocks=[];while(nextElement){if(nextElement.className.includes("-wrapper"))allBlocks.push(nextElement);nextElement=nextElement.nextSibling}section.append(...allBlocks);section.removeChild(contentWrapper)}));const newSection=div();let currentDiv=null;[...section.children].forEach((child=>{if(child.tagName==="H1"){newSection.appendChild(div({class:"col-left lg:w-1/3 xl:w-1/4 pt-4"}));currentDiv=div({class:"col-right w-full mt-0 md:mt-4 lg:mt-0 lg:w-2/3 xl:w-3/4 pt-6 pb-0 md:pb-10"})}const childClone=child.cloneNode(true);if(childClone.tagName==="H2"&&childClone.querySelector(":scope > strong")){if(currentDiv?.classList.contains("col-right")){newSection.appendChild(currentDiv)}childClone.className="text-gray-900 !text-base leading-6 font-bold pt-6 pb-4 my-0";newSection.appendChild(div({class:"col-left lg:w-1/3 xl:w-1/4 pt-4"},childClone,domEl("hr",{style:"height: 10px; width: 54px; border-width: 0px; color: rgb(216, 244, 250); background-color: rgb(216, 244, 250);"})));currentDiv=div({class:"col-right w-full mt-4 lg:mt-0 lg:w-2/3 xl:w-3/4 pt-6 pb-10"})}else if(currentDiv?.classList.contains("col-right")){currentDiv.appendChild(childClone)}}));if(currentDiv){newSection.appendChild(currentDiv)}newSection.classList.add("w-full","flex","flex-wrap","break-normal");section.innerHTML=newSection.outerHTML;section.classList.add("mx-auto","w-full","flex","flex-wrap","mb-5")}))}function updateExternalLinks(main){const REFERERS=[window.location.origin];main.querySelectorAll("a[href]").forEach((a=>{try{const{origin:origin,pathname:pathname,hash:hash}=new URL(a.href,window.location.href);const targetHash=hash&&hash.startsWith("#_");const isPDF=pathname.split(".").pop()==="pdf";if(origin&&origin!==window.location.origin&&!targetHash||isPDF){a.setAttribute("target","_blank");if(!REFERERS.includes(origin))a.setAttribute("rel","noopener")}else if(targetHash){a.setAttribute("target",hash.replace("#",""));a.href=a.href.replace(hash,"")}}catch(e){console.warn(`Invalid link in ${main}: ${a.href}`)}}))}function lazyLoadHiddenPageNavTabs(sections,nameOfFirstSection){const activeHash=window.location.hash;const active=activeHash?activeHash.substring(1,activeHash.length).toLowerCase():nameOfFirstSection;sections.forEach((section=>{const hasBreadCrumb=section.className.includes("breadcrumb-container");if(!hasBreadCrumb&§ion.getAttribute("aria-labelledby")!==active){section.querySelectorAll(".block").forEach((block=>{block.setAttribute("data-block-status","loaded");block.setAttribute("data-block-lazy-load",true);block.parentElement.style.display="none"}));const loadLazyBlocks=lazySection=>{lazySection.querySelectorAll(".block[data-block-lazy-load]").forEach((async block=>{block.removeAttribute("data-block-lazy-load");block.setAttribute("data-block-status","initialized");await loadBlock(block);block.parentElement.style.display=""}));section.setAttribute("data-section-status","loaded")};const observer=new IntersectionObserver((entries=>{if(entries.some((e=>e.isIntersecting))){observer.disconnect();loadLazyBlocks(section)}}));observer.observe(section);setTimeout((()=>{observer.disconnect();loadLazyBlocks(section)}),5e3)}}))}function decoratePageNav(main){const pageTabsBlock=main.querySelector(".page-tabs");if(!pageTabsBlock)return;const pageTabSection=pageTabsBlock.closest("div.section");let sections=[...main.querySelectorAll("div.section")];sections=sections.slice(sections.indexOf(pageTabSection)+1);const namedSections=sections.filter((section=>section.hasAttribute("data-tabname")));let index=0;sections.forEach((section=>{if(indeximport(dep)))]).then((([mod])=>mod.default));if(decorator){await decorator(main)}document.body.classList.add(templateName)}}catch(error){console.error("Auto Blocking failed",error)}}function decorateEmbeddedBlocks(container){container.querySelectorAll("div.section > div").forEach(decorateBlock)}export async function processEmbedFragment(element){const block=div({class:"embed-fragment"});[...element.classList].forEach((className=>{block.classList.add(className)}));const link=element.textContent;if(link){const fragment=await getFragmentFromFile(`${link}.plain.html`);if(fragment){block.innerHTML=fragment;const sections=block.querySelectorAll(".embed-fragment > div");[...sections].forEach((section=>{section.classList.add("section")}));decorateEmbeddedBlocks(block);decorateSections(block);loadBlocks(block)}else{const elementInner=element.innerHTML;block.append(div({class:"section"}));block.querySelector(".section").innerHTML=elementInner}}decorateButtons(block);decorateIcons(block);return block}function loadATPageParams(){const id=window.location.pathname.replaceAll("/","_").replace(/\.html$/,"").substring(1);const skuId=getMetadata("sku");const categoryId=getMetadata("fullcategory").split("|").pop();const thumbnailURL=getMetadata("og:image");const title=getMetadata("og:title");const name=title.indexOf("| Danaher Life Sciences")>-1?title.split("| Danaher Life Sciences")[0]:title;const message=getMetadata("og:description");const pageUrl=getMetadata("og:url");const brand=getMetadata("brand");const page=window.location.pathname.split("/")[3];const tags=getMetadata("article:tag");const articleAuthor=getMetadata("authorname");const articlePostDate=getMetadata("publishdate");const articleReadTime=getMetadata("readingtime");const targetParams={id:id,skuId:skuId,categoryId:categoryId,thumbnailURL:thumbnailURL,name:name,message:message,pageUrl:pageUrl,brand:brand,page:page,tags:tags,articleAuthor:articleAuthor,articlePostDate:articlePostDate,articleReadTime:articleReadTime};return targetParams}function initATJS(path,config){window.targetGlobalSettings=config;window.atPageParams=loadATPageParams();window.targetPageParams=function getTargetPageParams(){return{at_property:"6aeb619e-92d9-f4cf-f209-6d88ff58af6a","entity.id":window.atPageParams?.id,"entity.skuId":window.atPageParams?.skuId,"entity.categoryId":window.atPageParams?.categoryId,"entity.thumbnailURL":window.atPageParams?.thumbnailURL,"entity.name":window.atPageParams?.name,"entity.message":window.atPageParams?.message,"entity.pageUrl":window.atPageParams?.pageUrl,"entity.brand":window.atPageParams?.brand,"entity.page":window.atPageParams?.page,"entity.tags":window.atPageParams?.tags,"entity.articleAuthor":window.atPageParams?.articleAuthor,"entity.articlePostDate":window.atPageParams?.articlePostDate,"entity.articleReadTime":window.atPageParams?.articleReadTime,danaherCompany:localStorage.getItem("danaher_company")?localStorage.getItem("danaher_company"):"",utmCampaign:localStorage.getItem("danaher_utm_campaign")?localStorage.getItem("danaher_utm_campaign"):"",utmSource:localStorage.getItem("danaher_utm_source")?localStorage.getItem("danaher_utm_source"):"",utmMedium:localStorage.getItem("danaher_utm_medium")?localStorage.getItem("danaher_utm_medium"):"",utmContent:localStorage.getItem("danaher_utm_content")?localStorage.getItem("danaher_utm_content"):""}};return new Promise((resolve=>{import(path).then(resolve)}))}function onDecoratedElement(fn){if(document.querySelector('[data-block-status="loaded"],[data-section-status="loaded"]')){fn()}const observer=new MutationObserver((mutations=>{if(mutations.some((m=>m.target.tagName==="BODY"||m.target.dataset.sectionStatus==="loaded"||m.target.dataset.blockStatus==="loaded"))){fn()}}));observer.observe(document.querySelector("main"),{subtree:true,attributes:true,attributeFilter:["data-block-status","data-section-status"]});observer.observe(document.querySelector("body"),{childList:true})}function toCssSelector(selector){return selector.replace(/(\.\S+)?:eq\((\d+)\)/g,((_,clss,i)=>`:nth-child(${Number(i)+1}${clss?` of ${clss})`:""}`))}async function getElementForOffer(offer){const selector=offer.cssSelector||toCssSelector(offer.selector);return document.querySelector(selector)}async function getElementForMetric(metric){const selector=toCssSelector(metric.selector);return document.querySelector(selector)}async function getAndApplyOffers(){const response=await window.adobe.target.getOffers({request:{execute:{pageLoad:{}}}});const{options:options=[],metrics:metrics=[]}=response.execute.pageLoad;onDecoratedElement((()=>{window.adobe.target.applyOffers({response:response});options.forEach((o=>o.content=o.content.filter((c=>!getElementForOffer(c)))));metrics.map(((m,i)=>getElementForMetric(m)?i:-1)).filter((i=>i>=0)).reverse().map((i=>metrics.splice(i,1)))}))}let atjsPromise=Promise.resolve();const urlTarget=window.location.pathname;const regex=/^\/(us\/en\/products\.html)?$/;if(!regex.test(urlTarget)){atjsPromise=initATJS("./at.js",{clientCode:"danaher",serverDomain:"danaher.tt.omtrdc.net",imsOrgId:"08333E7B636A2D4D0A495C34@AdobeOrg",bodyHidingEnabled:false,cookieDomain:window.location.hostname,pageLoadEnabled:false,secureOnly:true,viewsEnabled:false,withWebGLRenderer:false}).catch((e=>{console.error("Error loading at.js",e)}));document.addEventListener("at-library-loaded",(()=>getAndApplyOffers()))}async function loadEager(doc){document.documentElement.lang="en";decorateTemplateAndTheme();await window.hlx.plugins.run("loadEager");const main=doc.querySelector("main");if(main){await decorateTemplates(main);decorateMain(main);await atjsPromise;await new Promise((resolve=>{window.requestAnimationFrame((async()=>{document.body.classList.add("appear");await waitForLCP(LCP_BLOCKS);resolve()}))}))}try{if(window.innerWidth>=900||sessionStorage.getItem("fonts-loaded")){loadFonts()}}catch(e){}}function getParameterByName(parameter,url=window.location.href){const modifiedParameter=parameter.replace(/[[\]]/g,"$&");const paramRegex=new RegExp(`[?&]${modifiedParameter}(=([^&#]*)|&|#|$)`);const results=paramRegex.exec(url);if(!results)return null;if(!results[2])return"";return decodeURIComponent(results[2].replace(/\+/g," "))}function loadUTMprams(){const utmParameters=["utm_campaign","utm_source","utm_medium","utm_content","utm_term","utm_previouspage"];utmParameters.forEach((param=>{const value=getParameterByName(param);if(value!==null){window.localStorage.setItem(`danaher_${param}`,value)}}))}async function loadLazy(doc){const main=doc.querySelector("main");await loadBlocks(main);const{hash:hash}=window.location;const element=hash?doc.getElementById(hash.substring(1)):false;if(hash&&element)element.scrollIntoView();loadFooter(doc.querySelector("footer"));loadCSS(`${window.hlx.codeBasePath}/styles/lazy-styles.css`);loadFonts();window.hlx.plugins.run("loadLazy");sampleRUM("lazy");sampleRUM.observe(main.querySelectorAll("div[data-block-name]"));sampleRUM.observe(main.querySelectorAll("picture > img"));loadUTMprams()}function loadDelayed(){window.setTimeout((()=>{window.hlx.plugins.load("delayed");window.hlx.plugins.run("loadDelayed");return import("./delayed.js")}),4e3)}async function loadPage(){setFavicon();await window.hlx.plugins.load("eager");await loadEager(document);await window.hlx.plugins.load("lazy");await loadLazy(document);loadDelayed()}function getDLPage(){const page={title:document.querySelector("title").textContent.replace(/[\n\t]/gm,""),language:"en",locale:"US",level:"top",type:"webpage",keywords:"",creationDate:getMetadata("creationdate"),updateDate:getMetadata("updatedate")};const path=window.location.pathname;if(path==="/"||path==="/us/en"||path==="/us/en.html"){page.level="top";page.type="home"}else if(path.includes("/us/en/news")){page.level="top";page.type="news"}else if(path.includes("/us/en/blog")){page.level="middle";page.type="blog"}else if(path.includes("/us/en/solutions")){page.level="middle";page.type="solutions"}else if(path.includes("/us/en/applications")){page.level="middle";page.type="applications"}else if(path.includes("/us/en/products")){if(path.includes("/us/en/products/family")){page.level="bottom";page.type="family"}else if(path.includes("/us/en/products/bundles")){page.level="bottom";page.type="bundles"}else if(path.includes("/us/en/products/sku")){page.level="bottom";page.type="sku"}else if(path.includes("/topics")){page.level="other";page.type="topics"}else{page.level="bottom";page.type="products"}}else if(path.includes("/us/en/library")){page.level="other";page.type="library"}else if(path.includes("/us/en/about-us")){page.level="top";page.type="about-us"}else if(path.includes("/us/en/expert")){page.level="top";page.type="expert"}else if(path.includes("/us/en/search")||path.includes("/us/en/danahersearch")){page.level="top";page.type="search"}else if(path.includes("/us/en/signin")){page.level="top";page.type="signin"}else if(path.includes("/us/en/legal")){page.level="top";page.type="legal"}return page}const urlParams=new URLSearchParams(window.location.search);const useProd=urlParams.get("useProd");if(window.location.host==="lifesciences.danaher.com"||useProd==="true"){window.DanaherConfig={siteID:"ls-us-en",gtmID:"GTM-THXPLCS",munchkinID:"306-EHG-641",marketoDomain:"//306-EHG-641.mktoweb.com",quoteCartPath:"/us/en/quote-cart.html",cartPath:"/us/en/cart.html",addressesPath:"/us/en/addresses.html",shippingPath:"/us/en/shipping.html",paymentPath:"/us/en/payment.html",receiptPath:"/us/en/receipt.html",quoteSubmitPath:"/us/en/submit-quote.html",intershopDomain:"https://shop.lifesciences.danaher.com",intershopPath:"/INTERSHOP/rest/WFS/DANAHERLS-LSIG-Site/-",searchOrg:"danaherproductionrfl96bkr",searchKey:"xxf2f10385-5a54-4a18-bb48-fd8025d6b5d2",workflowProductKey:"xx3d1b8da5-d1e9-4989-bbed-264a248a9e22",workflowResourceKey:"xxf6a8b387-10f2-4660-af5d-6d304d0a789d",productKey:"xxfb161aa6-0fa0-419f-af37-9c6d7784bf76",familyProductKey:"xx1ecd2a4f-8391-4c70-b3c0-2d589bda56b7",familyResourceKey:"xx9dd85afc-64b6-4295-bc5d-eb8285f96d52",categoryProductKey:"xx2a299d60-2cf1-48ab-b9d5-94daeb25f1d6",categoryDetailKey:"xx61910369-c1ab-4df9-8d8a-3092b1323fcc",productRecommendationsKey:"xx107716c0-1ccd-4a61-8717-6ca36b6cdb0e",megaMenuPath:"/content/dam/danaher/system/navigation/megamenu_items_us.json",coveoProductPageTitle:"Product Page",pdfEmbedKey:"4a472c386025439d8a4ce2493557f6e7",host:"lifesciences.danaher.com",scene7host:"https://danaherls.scene7.com"}}else{window.DanaherConfig={siteID:"ls-us-en",gtmID:"GTM-KCBGM2N",munchkinID:"439-KNJ-322",marketoDomain:"//439-KNJ-322.mktoweb.com",quoteCartPath:"/us/en/quote-cart.html",cartPath:"/us/en/cart.html",addressesPath:"/us/en/addresses.html",shippingPath:"/us/en/shipping.html",paymentPath:"/us/en/payment.html",receiptPath:"/us/en/receipt.html",quoteSubmitPath:"/us/en/submit-quote.html",intershopDomain:"https://stage.shop.lifesciences.danaher.com",intershopPath:"/INTERSHOP/rest/WFS/DANAHERLS-LSIG-Site/-",searchOrg:"danahernonproduction1892f3fhz",searchKey:"xx2a2e7271-78c3-4e3b-bac3-2fcbab75323b",workflowProductKey:"xx26ffc727-cc72-4bbd-98e3-34052f296382",workflowResourceKey:"xx14676f1d-cf4a-4a38-94f0-eda56e9920f1",productKey:"xx32da148e-dfd0-4725-a443-c05a7793afea",familyProductKey:"xx4e3989d6-93aa-4140-a227-19da35fcd1cc",familyResourceKey:"xx8274a91e-b29c-4267-8b3a-5022a2698605",categoryProductKey:"xxdf9d160d-f6e5-4c8c-969b-8570d7b81418",categoryDetailKey:"xxf2ea9bfd-bccb-4195-90fd-7757504fdc33",productRecommendationsKey:"xxea4d2c40-26e7-4e98-9377-d8ebe3f435ea",megaMenuPath:"/content/dam/danaher/system/navigation/megamenu_items_us.json",coveoProductPageTitle:"Product Page",pdfEmbedKey:"4a472c386025439d8a4ce2493557f6e7",host:"stage.lifesciences.danaher.com",scene7host:"https://s7d9.scene7.com"}}window.dataLayer=[];window.dataLayer.push({user:{customerID:"",accountType:"guest",marketCode:"",company:"",role:"",city:"",state:"",country:"",postalCode:"",lastVisit:""}});window.dataLayer.push({page:getDLPage()});loadPage(); \ No newline at end of file +import{sampleRUM,loadHeader,loadFooter,decorateButtons,decorateIcons,decorateSections,decorateBlocks,decorateTemplateAndTheme,waitForLCP,loadBlocks,loadCSS,toClassName,getMetadata,createOptimizedPicture,loadBlock,decorateBlock}from"./lib-franklin.js";import{div,domEl,img}from"./dom-builder.js";const LCP_BLOCKS=["breadcrumb","product-hero","carousel","columns"];const TEMPLATE_LIST={blog:{templateName:"blog",dependencies:["./schema.js","../blocks/columns/columns.js","../blocks/social-media/social-media.js","../blocks/article-info/article-info.js"]},productdetail:{templateName:"productDetail",dependencies:["./commerce.js","./product-payload-builder.js","./schema.js"]},processstep:"processstep",topic:"topic",library:"library",info:"library"};TEMPLATE_LIST.news=TEMPLATE_LIST.blog;export function imageHelper(imageUrl,imageAlt,eager=false){if(imageUrl.indexOf(".scene7.com")>-1){return img({src:`${imageUrl}`,alt:imageAlt,loading:eager?"eager":"lazy",class:"mb-2 h-48 w-full object-cover"})}const cardImage=createOptimizedPicture(imageUrl,imageAlt,eager,[{width:"500"}]);cardImage.querySelector("img").className="mb-2 h-48 w-full object-cover";return cardImage}export function createOptimizedS7Picture(src,alt="",eager=false){if(src.startsWith("/is/image")||src.indexOf(".scene7.com")>-1){const picture=document.createElement("picture");picture.appendChild(img({src:`${src}?$danaher-mobile$`,fetchpriority:"high",alt:alt,loading:eager?"eager":"lazy"}));return picture}return img({src:src,alt:alt,loading:eager?"eager":"lazy"})}export function formatDateUTCSeconds(date,options={}){const dateObj=new Date(0);dateObj.setUTCSeconds(date);return dateObj.toLocaleDateString("en-US",{month:"short",day:"2-digit",year:"numeric",...options})}export function generateUUID(){return Math.floor(1e3+Math.random()*9e3)}let originalOffset=0;export function scrollJumpMenuFixed(pageJumpMenuContainer){if(!originalOffset){const rectPageTabs=pageJumpMenuContainer.getBoundingClientRect();originalOffset=rectPageTabs.top}if(window.scrollY>originalOffset){pageJumpMenuContainer.classList.add(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-jump-menu-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));document.querySelector(".page-jump-menu-container.fixed ul")?.classList.add("shadow-none","rounded-none");document.querySelectorAll(".page-jump-menu-container.fixed ul li")?.forEach((el=>{el?.firstElementChild?.classList.add("rounded-full");el?.firstElementChild?.querySelector("span.icon svg use")?.classList.add("stroke-danaherpurple-500")}));document.querySelector('.page-jump-menu-container.fixed li[aria-selected="true"] a span.icon svg')?.classList.add("stroke-white");pageJumpMenuContainer.classList.remove(..."[&_.page-jump-menu-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}else{pageJumpMenuContainer.classList.remove(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-jump-menu-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));document.querySelectorAll(".page-jump-menu-container ul li")?.forEach((el=>{el?.firstElementChild?.classList.remove("rounded-full");el?.firstElementChild?.querySelector("span.icon svg use")?.classList.remove("stroke-danaherpurple-500")}));pageJumpMenuContainer.classList.add(..."[&_.page-jump-menu-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}}let pageTabsOriginalOffset=0;export function scrollPageTabFixed(pageTabsContainer){if(!pageTabsOriginalOffset){const rectPageTabs=pageTabsContainer.getBoundingClientRect();pageTabsOriginalOffset=rectPageTabs.top}if(window.scrollY>pageTabsOriginalOffset){pageTabsContainer.classList.add(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-tabs-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));pageTabsContainer.classList.remove(..."[&_.page-tabs-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}else{pageTabsContainer.classList.remove(..."w-full fixed mt-[-1px] bg-white shadow-lg inset-x-0 top-[83px] py-2 z-10 [&_.page-tabs-wrapper]:md:max-w-7xl [&_ul>li>a]:flex-row [&_ul>li>a]:items-center [&_ul>li>a]:h-full [&_li>a>span.icon-chevron-down]:hidden".split(" "));pageTabsContainer.classList.add(..."[&_.page-tabs-wrapper]:md:max-w-max [&_ul]:divide-x [&_ul>li>a]:h-40 [&_ul>li>a]:flex-col [&_ul>li>a]:justify-center".split(" "))}}export function makePublicUrl(url){const isProd=window.location.hostname.includes("lifesciences.danaher.com");try{const newURL=new URL(url,window.location.origin);if(isProd){if(newURL.pathname.endsWith(".html")){return newURL.pathname}newURL.pathname+=".html";return newURL.pathname}if(newURL.pathname.endsWith(".html")){newURL.pathname=newURL.pathname.slice(0,-5);return newURL.pathname}return newURL.pathname}catch(error){console.error("Invalid URL:",error);return url}}export function setJsonLd(data,name){const existingScript=document.head.querySelector(`script[data-name="${name}"]`);if(existingScript){existingScript.innerHTML=JSON.stringify(data);return}const script=document.createElement("script");script.type="application/ld+json";script.innerHTML=JSON.stringify(data);script.dataset.name=name;document.head.appendChild(script)}function setFavicon(){const faviconLink=document.querySelector("link[rel*='icon']")||document.createElement("link");faviconLink.type="image/x-icon";faviconLink.rel="shortcut icon";faviconLink.href=`https://${window.location.hostname}/favicon.ico`;document.getElementsByTagName("head")[0].appendChild(faviconLink)}export async function getFragmentFromFile(url){const response=await fetch(url);if(!response.ok){console.error("error loading fragment details",response);return null}const text=await response.text();if(!text){console.error("fragment details empty",url);return null}return text}export function getCookie(cname){let value=decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(cname).replace(/[\\-\\.\\+\\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null;if(value&&(value.substring(0,1)==="{"&&value.substring(value.length-1,value.length)==="}"||value.substring(0,1)==="["&&value.substring(value.length-1,value.length)==="]")){try{value=JSON.parse(value)}catch(e){return value}}return value}export function isOTEnabled(){const otCookie=getCookie("OptanonConsent");if(typeof otCookie==="string"){return otCookie.includes("C0002:1")}return true}export function setCookie(cname,cvalue,expTime=30*1e3*60*60*24,path="/"){const today=new Date;today.setTime(today.getTime()+expTime);const expires="expires=".concat(today.toGMTString());const cookieString=cname.concat("=").concat(cvalue).concat(";").concat(expires).concat(";path=").concat(path);document.cookie=cookieString}async function buildVideo(main){const videoLinks=main.querySelectorAll('a[href*="youtube.com"],a[href*="vimeo.com"],a[href*="vidyard.com"]');if(videoLinks.length>0){const{default:decorateEmbed}=await import("../blocks/embed/embed.js");videoLinks.forEach((link=>{if(link.closest(".embed, .hero")==null){decorateEmbed(link.parentNode)}}))}}async function loadFonts(){await loadCSS(`${window.hlx.codeBasePath}/styles/fonts.css`);try{if(!window.location.hostname.includes("localhost"))sessionStorage.setItem("fonts-loaded","true")}catch(e){}}function loadBreadCrumb(){const header=document.querySelector("header");const breadcrumb=document.createElement("breadcrumb");if(window.location.pathname!=="/")header.after(breadcrumb)}function loadMobileMenu(){const breadcrumb=document.querySelector("breadcrumb");const mobileMunu=document.createElement("mobilemenu");const url=new URL(window.location.href);if(url.pathname.match(/\/us\/en\/products\/(family\/|sku\/|bundles\/)/)||url.pathname.match(/\/us\/en\/solutions\//)){breadcrumb.after(mobileMunu)}}function buildAutoBlocks(main){try{buildVideo(main)}catch(error){console.error("Auto Blocking failed",error)}}export function decorateModals(main){const ctaModalButton=main.querySelector(".show-modal-btn");const content=()=>ctaModalButton.getAttribute("data-dialog-message")?ctaModalButton.getAttribute("dialog-message"):"";ctaModalButton?.addEventListener("click",(async e=>{e.preventDefault();const{default:getModal}=await import("./modal.js");const customModal=await getModal("custom-modal",content,(modal=>{modal.querySelector('p[name="close"]')?.addEventListener("click",(()=>modal.close()))}));customModal.showModal()}))}function decorateTwoColumnSection(main){main.querySelectorAll(".section.container-two-col").forEach((section=>{const defaultContentWrappers=section.querySelectorAll(":scope > .default-content-wrapper");defaultContentWrappers.forEach((contentWrapper=>{[...contentWrapper.children].forEach((child=>{section.appendChild(child)}));let nextElement=contentWrapper.nextSibling;const allBlocks=[];while(nextElement){if(nextElement.className.includes("-wrapper"))allBlocks.push(nextElement);nextElement=nextElement.nextSibling}section.append(...allBlocks);section.removeChild(contentWrapper)}));const newSection=div();let currentDiv=null;[...section.children].forEach((child=>{if(child.tagName==="H1"){newSection.appendChild(div({class:"col-left lg:w-1/3 xl:w-1/4 pt-4"}));currentDiv=div({class:"col-right w-full mt-0 md:mt-4 lg:mt-0 lg:w-2/3 xl:w-3/4 pt-6 pb-0 md:pb-10"})}const childClone=child.cloneNode(true);if(childClone.tagName==="H2"&&childClone.querySelector(":scope > strong")){if(currentDiv?.classList.contains("col-right")){newSection.appendChild(currentDiv)}childClone.className="text-gray-900 !text-base leading-6 font-bold pt-6 pb-4 my-0";newSection.appendChild(div({class:"col-left lg:w-1/3 xl:w-1/4 pt-4"},childClone,domEl("hr",{style:"height: 10px; width: 54px; border-width: 0px; color: rgb(216, 244, 250); background-color: rgb(216, 244, 250);"})));currentDiv=div({class:"col-right w-full mt-4 lg:mt-0 lg:w-2/3 xl:w-3/4 pt-6 pb-10"})}else if(currentDiv?.classList.contains("col-right")){currentDiv.appendChild(childClone)}}));if(currentDiv){newSection.appendChild(currentDiv)}newSection.classList.add("w-full","flex","flex-wrap","break-normal");section.innerHTML=newSection.outerHTML;section.classList.add("mx-auto","w-full","flex","flex-wrap","mb-5")}))}function updateExternalLinks(main){const REFERERS=[window.location.origin];main.querySelectorAll("a[href]").forEach((a=>{try{const{origin:origin,pathname:pathname,hash:hash}=new URL(a.href,window.location.href);const targetHash=hash&&hash.startsWith("#_");const isPDF=pathname.split(".").pop()==="pdf";if(origin&&origin!==window.location.origin&&!targetHash||isPDF){a.setAttribute("target","_blank");if(!REFERERS.includes(origin))a.setAttribute("rel","noopener")}else if(targetHash){a.setAttribute("target",hash.replace("#",""));a.href=a.href.replace(hash,"")}}catch(e){console.warn(`Invalid link in ${main}: ${a.href}`)}}))}function lazyLoadHiddenPageNavTabs(sections,nameOfFirstSection){const activeHash=window.location.hash;const active=activeHash?activeHash.substring(1,activeHash.length).toLowerCase():nameOfFirstSection;sections.forEach((section=>{const hasBreadCrumb=section.className.includes("breadcrumb-container");if(!hasBreadCrumb&§ion.getAttribute("aria-labelledby")!==active){section.querySelectorAll(".block").forEach((block=>{block.setAttribute("data-block-status","loaded");block.setAttribute("data-block-lazy-load",true);block.parentElement.style.display="none"}));const loadLazyBlocks=lazySection=>{lazySection.querySelectorAll(".block[data-block-lazy-load]").forEach((async block=>{block.removeAttribute("data-block-lazy-load");block.setAttribute("data-block-status","initialized");await loadBlock(block);block.parentElement.style.display=""}));section.setAttribute("data-section-status","loaded")};const observer=new IntersectionObserver((entries=>{if(entries.some((e=>e.isIntersecting))){observer.disconnect();loadLazyBlocks(section)}}));observer.observe(section);setTimeout((()=>{observer.disconnect();loadLazyBlocks(section)}),5e3)}}))}function decoratePageNav(main){const pageTabsBlock=main.querySelector(".page-tabs");if(!pageTabsBlock)return;const pageTabSection=pageTabsBlock.closest("div.section");let sections=[...main.querySelectorAll("div.section")];sections=sections.slice(sections.indexOf(pageTabSection)+1);const namedSections=sections.filter((section=>section.hasAttribute("data-tabname")));let index=0;sections.forEach((section=>{if(indeximport(dep)))]).then((([mod])=>mod.default));if(decorator){await decorator(main)}document.body.classList.add(templateName)}}catch(error){console.error("Auto Blocking failed",error)}}function decorateEmbeddedBlocks(container){container.querySelectorAll("div.section > div").forEach(decorateBlock)}export async function processEmbedFragment(element){const block=div({class:"embed-fragment"});[...element.classList].forEach((className=>{block.classList.add(className)}));const link=element.textContent;if(link){const fragment=await getFragmentFromFile(`${link}.plain.html`);if(fragment){block.innerHTML=fragment;const sections=block.querySelectorAll(".embed-fragment > div");[...sections].forEach((section=>{section.classList.add("section")}));decorateEmbeddedBlocks(block);decorateSections(block);loadBlocks(block)}else{const elementInner=element.innerHTML;block.append(div({class:"section"}));block.querySelector(".section").innerHTML=elementInner}}decorateButtons(block);decorateIcons(block);return block}function loadATPageParams(){const id=window.location.pathname.replaceAll("/","_").replace(/\.html$/,"").substring(1);const skuId=getMetadata("sku");const categoryId=getMetadata("fullcategory").split("|").pop();const thumbnailURL=getMetadata("og:image");const title=getMetadata("og:title");const name=title.indexOf("| Danaher Life Sciences")>-1?title.split("| Danaher Life Sciences")[0]:title;const message=getMetadata("og:description");const pageUrl=getMetadata("og:url");const brand=getMetadata("brand");const page=window.location.pathname.split("/")[3];const tags=getMetadata("article:tag");const articleAuthor=getMetadata("authorname");const articlePostDate=getMetadata("publishdate");const articleReadTime=getMetadata("readingtime");const targetParams={id:id,skuId:skuId,categoryId:categoryId,thumbnailURL:thumbnailURL,name:name,message:message,pageUrl:pageUrl,brand:brand,page:page,tags:tags,articleAuthor:articleAuthor,articlePostDate:articlePostDate,articleReadTime:articleReadTime};return targetParams}function initATJS(path,config){window.targetGlobalSettings=config;window.atPageParams=loadATPageParams();window.targetPageParams=function getTargetPageParams(){return{at_property:"6aeb619e-92d9-f4cf-f209-6d88ff58af6a","entity.id":window.atPageParams?.id,"entity.skuId":window.atPageParams?.skuId,"entity.categoryId":window.atPageParams?.categoryId,"entity.thumbnailURL":window.atPageParams?.thumbnailURL,"entity.name":window.atPageParams?.name,"entity.message":window.atPageParams?.message,"entity.pageUrl":window.atPageParams?.pageUrl,"entity.brand":window.atPageParams?.brand,"entity.page":window.atPageParams?.page,"entity.tags":window.atPageParams?.tags,"entity.articleAuthor":window.atPageParams?.articleAuthor,"entity.articlePostDate":window.atPageParams?.articlePostDate,"entity.articleReadTime":window.atPageParams?.articleReadTime,danaherCompany:localStorage.getItem("danaher_company")?localStorage.getItem("danaher_company"):"",utmCampaign:localStorage.getItem("danaher_utm_campaign")?localStorage.getItem("danaher_utm_campaign"):"",utmSource:localStorage.getItem("danaher_utm_source")?localStorage.getItem("danaher_utm_source"):"",utmMedium:localStorage.getItem("danaher_utm_medium")?localStorage.getItem("danaher_utm_medium"):"",utmContent:localStorage.getItem("danaher_utm_content")?localStorage.getItem("danaher_utm_content"):""}};return new Promise((resolve=>{import(path).then(resolve)}))}function onDecoratedElement(fn){if(document.querySelector('[data-block-status="loaded"],[data-section-status="loaded"]')){fn()}const observer=new MutationObserver((mutations=>{if(mutations.some((m=>m.target.tagName==="BODY"||m.target.dataset.sectionStatus==="loaded"||m.target.dataset.blockStatus==="loaded"))){fn()}}));observer.observe(document.querySelector("main"),{subtree:true,attributes:true,attributeFilter:["data-block-status","data-section-status"]});observer.observe(document.querySelector("body"),{childList:true})}function toCssSelector(selector){return selector.replace(/(\.\S+)?:eq\((\d+)\)/g,((_,clss,i)=>`:nth-child(${Number(i)+1}${clss?` of ${clss})`:""}`))}async function getElementForOffer(offer){const selector=offer.cssSelector||toCssSelector(offer.selector);return document.querySelector(selector)}async function getElementForMetric(metric){const selector=toCssSelector(metric.selector);return document.querySelector(selector)}async function getAndApplyOffers(){const response=await window.adobe.target.getOffers({request:{execute:{pageLoad:{}}}});const{options:options=[],metrics:metrics=[]}=response.execute.pageLoad;onDecoratedElement((()=>{window.adobe.target.applyOffers({response:response});options.forEach((o=>o.content=o.content.filter((c=>!getElementForOffer(c)))));metrics.map(((m,i)=>getElementForMetric(m)?i:-1)).filter((i=>i>=0)).reverse().map((i=>metrics.splice(i,1)))}))}let atjsPromise=Promise.resolve();const urlTarget=window.location.pathname;const regex=/^\/(us\/en\/products\.html)?$/;if(!regex.test(urlTarget)){atjsPromise=initATJS("./at.js",{clientCode:"danaher",serverDomain:"danaher.tt.omtrdc.net",imsOrgId:"08333E7B636A2D4D0A495C34@AdobeOrg",bodyHidingEnabled:false,cookieDomain:window.location.hostname,pageLoadEnabled:false,secureOnly:true,viewsEnabled:false,withWebGLRenderer:false}).catch((e=>{console.error("Error loading at.js",e)}));document.addEventListener("at-library-loaded",(()=>getAndApplyOffers()))}async function loadEager(doc){document.documentElement.lang="en";decorateTemplateAndTheme();await window.hlx.plugins.run("loadEager");const main=doc.querySelector("main");if(main){await decorateTemplates(main);decorateMain(main);await atjsPromise;await new Promise((resolve=>{window.requestAnimationFrame((async()=>{document.body.classList.add("appear");await waitForLCP(LCP_BLOCKS);resolve()}))}))}try{if(window.innerWidth>=900||sessionStorage.getItem("fonts-loaded")){loadFonts()}}catch(e){}}function getParameterByName(parameter,url=window.location.href){const modifiedParameter=parameter.replace(/[[\]]/g,"$&");const paramRegex=new RegExp(`[?&]${modifiedParameter}(=([^&#]*)|&|#|$)`);const results=paramRegex.exec(url);if(!results)return null;if(!results[2])return"";return decodeURIComponent(results[2].replace(/\+/g," "))}function loadUTMprams(){const utmParameters=["utm_campaign","utm_source","utm_medium","utm_content","utm_term","utm_previouspage"];utmParameters.forEach((param=>{const value=getParameterByName(param);if(value!==null){window.localStorage.setItem(`danaher_${param}`,value)}}))}async function loadLazy(doc){const main=doc.querySelector("main");await loadBlocks(main);const{hash:hash}=window.location;const element=hash?doc.getElementById(hash.substring(1)):false;if(hash&&element)element.scrollIntoView();loadFooter(doc.querySelector("footer"));loadCSS(`${window.hlx.codeBasePath}/styles/lazy-styles.css`);loadFonts();window.hlx.plugins.run("loadLazy");sampleRUM("lazy");sampleRUM.observe(main.querySelectorAll("div[data-block-name]"));sampleRUM.observe(main.querySelectorAll("picture > img"));loadUTMprams()}function loadDelayed(){window.setTimeout((()=>{window.hlx.plugins.load("delayed");window.hlx.plugins.run("loadDelayed");return import("./delayed.js")}),4e3)}async function loadPage(){setFavicon();await window.hlx.plugins.load("eager");await loadEager(document);await window.hlx.plugins.load("lazy");await loadLazy(document);loadDelayed()}function getDLPage(){const page={title:document.querySelector("title").textContent.replace(/[\n\t]/gm,""),language:"en",locale:"US",level:"top",type:"webpage",keywords:"",creationDate:getMetadata("creationdate"),updateDate:getMetadata("updatedate")};const path=window.location.pathname;if(path==="/"||path==="/us/en"||path==="/us/en.html"){page.level="top";page.type="home"}else if(path.includes("/us/en/news")){page.level="top";page.type="news"}else if(path.includes("/us/en/blog")){page.level="middle";page.type="blog"}else if(path.includes("/us/en/solutions")){page.level="middle";page.type="solutions"}else if(path.includes("/us/en/applications")){page.level="middle";page.type="applications"}else if(path.includes("/us/en/products")){if(path.includes("/us/en/products/family")){page.level="bottom";page.type="family"}else if(path.includes("/us/en/products/bundles")){page.level="bottom";page.type="bundles"}else if(path.includes("/us/en/products/sku")){page.level="bottom";page.type="sku"}else if(path.includes("/topics")){page.level="other";page.type="topics"}else{page.level="bottom";page.type="products"}}else if(path.includes("/us/en/library")){page.level="other";page.type="library"}else if(path.includes("/us/en/about-us")){page.level="top";page.type="about-us"}else if(path.includes("/us/en/expert")){page.level="top";page.type="expert"}else if(path.includes("/us/en/search")||path.includes("/us/en/danahersearch")){page.level="top";page.type="search"}else if(path.includes("/us/en/signin")){page.level="top";page.type="signin"}else if(path.includes("/us/en/legal")){page.level="top";page.type="legal"}return page}const urlParams=new URLSearchParams(window.location.search);const useProd=urlParams.get("useProd");if(window.location.host==="lifesciences.danaher.com"||useProd==="true"){window.DanaherConfig={siteID:"ls-us-en",gtmID:"GTM-THXPLCS",munchkinID:"306-EHG-641",marketoDomain:"//306-EHG-641.mktoweb.com",quoteCartPath:"/us/en/quote-cart.html",cartPath:"/us/en/cart.html",addressesPath:"/us/en/addresses.html",shippingPath:"/us/en/shipping.html",paymentPath:"/us/en/payment.html",receiptPath:"/us/en/receipt.html",quoteSubmitPath:"/us/en/submit-quote.html",intershopDomain:"https://shop.lifesciences.danaher.com",intershopPath:"/INTERSHOP/rest/WFS/DANAHERLS-LSIG-Site/-",searchOrg:"danaherproductionrfl96bkr",searchKey:"xxf2f10385-5a54-4a18-bb48-fd8025d6b5d2",workflowProductKey:"xx3d1b8da5-d1e9-4989-bbed-264a248a9e22",workflowResourceKey:"xxf6a8b387-10f2-4660-af5d-6d304d0a789d",productKey:"xxfb161aa6-0fa0-419f-af37-9c6d7784bf76",familyProductKey:"xx1ecd2a4f-8391-4c70-b3c0-2d589bda56b7",familyResourceKey:"xx9dd85afc-64b6-4295-bc5d-eb8285f96d52",categoryProductKey:"xx2a299d60-2cf1-48ab-b9d5-94daeb25f1d6",categoryDetailKey:"xx61910369-c1ab-4df9-8d8a-3092b1323fcc",productRecommendationsKey:"xx107716c0-1ccd-4a61-8717-6ca36b6cdb0e",megaMenuPath:"/content/dam/danaher/system/navigation/megamenu_items_us.json",coveoProductPageTitle:"Product Page",pdfEmbedKey:"4a472c386025439d8a4ce2493557f6e7",host:"lifesciences.danaher.com",scene7host:"https://danaherls.scene7.com"}}else{window.DanaherConfig={siteID:"ls-us-en",gtmID:"GTM-KCBGM2N",munchkinID:"439-KNJ-322",marketoDomain:"//439-KNJ-322.mktoweb.com",quoteCartPath:"/us/en/quote-cart.html",cartPath:"/us/en/cart.html",addressesPath:"/us/en/addresses.html",shippingPath:"/us/en/shipping.html",paymentPath:"/us/en/payment.html",receiptPath:"/us/en/receipt.html",quoteSubmitPath:"/us/en/submit-quote.html",intershopDomain:"https://stage.shop.lifesciences.danaher.com",intershopPath:"/INTERSHOP/rest/WFS/DANAHERLS-LSIG-Site/-",searchOrg:"danahernonproduction1892f3fhz",searchKey:"xx2a2e7271-78c3-4e3b-bac3-2fcbab75323b",workflowProductKey:"xx26ffc727-cc72-4bbd-98e3-34052f296382",workflowResourceKey:"xx14676f1d-cf4a-4a38-94f0-eda56e9920f1",productKey:"xx32da148e-dfd0-4725-a443-c05a7793afea",familyProductKey:"xx4e3989d6-93aa-4140-a227-19da35fcd1cc",familyResourceKey:"xx8274a91e-b29c-4267-8b3a-5022a2698605",categoryProductKey:"xxdf9d160d-f6e5-4c8c-969b-8570d7b81418",categoryDetailKey:"xxf2ea9bfd-bccb-4195-90fd-7757504fdc33",productRecommendationsKey:"xxea4d2c40-26e7-4e98-9377-d8ebe3f435ea",megaMenuPath:"/content/dam/danaher/system/navigation/megamenu_items_us.json",coveoProductPageTitle:"Product Page",pdfEmbedKey:"4a472c386025439d8a4ce2493557f6e7",host:"stage.lifesciences.danaher.com",scene7host:"https://s7d9.scene7.com"}}window.dataLayer=[];window.dataLayer.push({user:{customerID:"",accountType:"guest",marketCode:"",company:"",role:"",city:"",state:"",country:"",postalCode:"",lastVisit:""}});window.dataLayer.push({page:getDLPage()});loadPage(); \ No newline at end of file diff --git a/tools/actions/convert/test/converter.test.js b/tools/actions/convert/test/converter.test.js index 2137f73bb..33f9185eb 100644 --- a/tools/actions/convert/test/converter.test.js +++ b/tools/actions/convert/test/converter.test.js @@ -40,5 +40,5 @@ describe('Converter', async () => { .reply(200, megamenu, { 'content-type': 'application/json' }); }); - await testRunner(['solutions1.html']); + await testRunner(); }); From 20aeb5ea215a2729656541f37a8bc784fdb3a7dd Mon Sep 17 00:00:00 2001 From: deepakk799 Date: Tue, 2 Jul 2024 16:48:07 -0400 Subject: [PATCH 02/11] fix: [Bug] images reference not sent in the RFQ API call --- scripts/quote-modal.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/quote-modal.js b/scripts/quote-modal.js index a99e0247e..eb8b6245a 100644 --- a/scripts/quote-modal.js +++ b/scripts/quote-modal.js @@ -33,9 +33,8 @@ export function addRequestforQuote(dialogElement, gotoQuoteCart = false) { return false; } quoteText.classList.remove('border-red-500'); - const image = document.getElementsByClassName('imageviewer')?.item(0)?.getElementsByTagName('img')?.item(0) - ?.getAttribute('src') ? `${window.location.origin}${document.getElementsByClassName('imageviewer')?.item(0)?.getElementsByTagName('img')?.item(0)}` - ?.getAttribute('src') : undefined; + const image = document.getElementsByClassName('image-content')?.item(0)?.getElementsByTagName('img')?.item(0) + ?.getAttribute('src'); const opco = getMetadata('brand'); const referrerTitle = dialogElement.getAttribute('data-referrer-title'); const country = dialogElement.getAttribute('country'); From 75e26f2458e5d0b0d3c852415e6a56b349c5d146 Mon Sep 17 00:00:00 2001 From: jckautzmann Date: Mon, 8 Jul 2024 13:05:22 +0200 Subject: [PATCH 03/11] [UE] fix issues with the Authoring experience (#1202) * fix: base path init * fix: add articles index to path mapping * fix: add path mapping for header and footer * fix: breadcrumb logic on author * fix: remove .html extension for path lookup * fix: capitalise first word in breadcrumb item * fix: temporarily add template to metadata * fix: preserve hero img instrumentation * fix: set background color on body * [UE] fix date rendering in the property rail * fix AEM tag field * fix og:url (needs to be a url, not a path) --------- Co-authored-by: Dirk --- blocks/breadcrumb/breadcrumb.js | 7 +++-- blocks/related-articles/related-articles.js | 2 +- blocks/tags-list/tags-list.js | 2 +- component-models.json | 10 ++++-- paths.json | 5 ++- scripts/lib-franklin-dev.js | 7 ++++- scripts/lib-franklin.js | 2 +- scripts/scripts-dev.js | 34 +++++++++++++++++++++ scripts/scripts.js | 2 +- styles/styles.css | 2 ++ styles/tailwind.css | 2 +- templates/blog/blog.js | 10 ++++++ 12 files changed, 74 insertions(+), 11 deletions(-) diff --git a/blocks/breadcrumb/breadcrumb.js b/blocks/breadcrumb/breadcrumb.js index e2dc305ac..5e98cf79e 100644 --- a/blocks/breadcrumb/breadcrumb.js +++ b/blocks/breadcrumb/breadcrumb.js @@ -7,7 +7,9 @@ const TEMPLATE_PATH_PATTERN = /\/us\/en\/[^/]+\/topics-template/; async function getItems() { // get the breadcrumb items from the page path, only after '/us/en' - const path = window.location.pathname; + let path = window.location.pathname; + if (path.startsWith('/content/danaher/ls')) path = path.substring(19); + if (path.endsWith('.html')) path = path.substring(0, path.length - 5); const pathParts = path.split('/'); const itemPaths = pathParts.length > 2 ? pathParts.slice(3).map((_, i) => pathParts.slice(0, i + 4).join('/')) : []; const articles = await ffetch('/us/en/article-index.json') @@ -18,7 +20,8 @@ async function getItems() { return itemPaths.map((itemPath) => { // get the title from the article, based on its path const article = articles.find((entry) => entry.path === itemPath); - const title = (article && article.navTitle !== '') ? article.navTitle : itemPath.split('/').pop(); + let title = (article && article.navTitle !== '') ? article.navTitle : itemPath.split('/').pop(); + title = title.charAt(0).toUpperCase() + title.slice(1); return { title, href: `${itemPath}.html`, diff --git a/blocks/related-articles/related-articles.js b/blocks/related-articles/related-articles.js index c6605f4d0..14ebb84ff 100644 --- a/blocks/related-articles/related-articles.js +++ b/blocks/related-articles/related-articles.js @@ -8,7 +8,7 @@ import createCard from '../card-list/articleCard.js'; export default async function decorate(block) { const articleType = getMetadata('template').toLowerCase(); const articleTopics = getMetadata('topics')?.toLowerCase(); - const url = new URL(getMetadata('og:url')); + const url = new URL(getMetadata('og:url'), window.location.origin); let articles = await ffetch('/us/en/article-index.json') .filter(({ type }) => type.toLowerCase() === articleType) .filter(({ topics }) => topics.toLowerCase() === articleTopics) diff --git a/blocks/tags-list/tags-list.js b/blocks/tags-list/tags-list.js index 3ae74dd0e..6d82c07a0 100644 --- a/blocks/tags-list/tags-list.js +++ b/blocks/tags-list/tags-list.js @@ -9,7 +9,7 @@ import { createFilters } from '../card-list/card-list.js'; export default async function decorate(block) { const articleType = getMetadata('template').toLowerCase(); const articleTopics = getMetadata('topics')?.toLowerCase(); - const url = new URL(getMetadata('og:url')); + const url = new URL(getMetadata('og:url'), window.location.origin); let articles = await ffetch('/us/en/article-index.json') .filter(({ type }) => type.toLowerCase() === articleType) .filter(({ topics }) => topics.toLowerCase() === articleTopics) diff --git a/component-models.json b/component-models.json index 692aaebe5..df435f339 100644 --- a/component-models.json +++ b/component-models.json @@ -28,7 +28,6 @@ "component": "aem-tag", "valueType": "string", "name": "cq:tags", - "multi": true, "label": "AEM Tag Picker" }, { @@ -71,7 +70,7 @@ }, { "component": "date-time", - "valueType": "date", + "valueType": "date-time", "name": "publishDate", "label": "Publish Date", "placeholder": "YYYY-MM-DD", @@ -83,6 +82,13 @@ "valueType": "string", "name": "navTitle", "label": "Navigation Title" + }, + { + "component": "text", + "valueType": "string", + "name": "template", + "label": "Template (temporary)", + "description": "Until we get the metadata spreadsheet fixed" } ] } diff --git a/paths.json b/paths.json index cbb8084b1..d123f7b8e 100644 --- a/paths.json +++ b/paths.json @@ -8,7 +8,10 @@ "/content/dam/danaher/franklin/metadata.json:/metadata.json", "/content/dam/danaher/franklin/metadata-products.json:/metadata-products.json", "/content/dam/danaher/franklin/metadata-articles.json:/metadata-articles.json", - "/content/dam/danaher/franklin/redirects.json:/redirects.json" + "/content/dam/danaher/franklin/redirects.json:/redirects.json", + "/content/danaher.resource/us/en/article-index.json:/us/en/article-index.json", + "/content/danaher.resource/fragments/header/master.plain.html:/fragments/header/master.plain.html", + "/content/danaher.resource/fragments/footer.html:/fragments/footer.html" ], "includes": [ "/content/danaher/ls/us/en", diff --git a/scripts/lib-franklin-dev.js b/scripts/lib-franklin-dev.js index 9e2146fed..405ecf9ec 100644 --- a/scripts/lib-franklin-dev.js +++ b/scripts/lib-franklin-dev.js @@ -862,7 +862,12 @@ export function setup() { const scriptEl = document.querySelector('script[src$="/scripts/scripts.js"]'); if (scriptEl) { try { - [window.hlx.codeBasePath] = new URL(scriptEl.src).pathname.split('/scripts/scripts.js'); + const scriptURL = new URL(scriptEl.src, window.location); + if (scriptURL.host === window.location.host) { + [window.hlx.codeBasePath] = scriptURL.pathname.split('/scripts/scripts.js'); + } else { + [window.hlx.codeBasePath] = scriptURL.href.split('/scripts/scripts.js'); + } } catch (error) { // eslint-disable-next-line no-console console.log(error); diff --git a/scripts/lib-franklin.js b/scripts/lib-franklin.js index 39e172cab..d09e862f5 100644 --- a/scripts/lib-franklin.js +++ b/scripts/lib-franklin.js @@ -1 +1 @@ -export function sampleRUM(checkpoint,data={}){sampleRUM.defer=sampleRUM.defer||[];const defer=fnname=>{sampleRUM[fnname]=sampleRUM[fnname]||((...args)=>sampleRUM.defer.push({fnname:fnname,args:args}))};sampleRUM.drain=sampleRUM.drain||((dfnname,fn)=>{sampleRUM[dfnname]=fn;sampleRUM.defer.filter((({fnname:fnname})=>dfnname===fnname)).forEach((({fnname:fnname,args:args})=>sampleRUM[fnname](...args)))});sampleRUM.always=sampleRUM.always||[];sampleRUM.always.on=(chkpnt,fn)=>{sampleRUM.always[chkpnt]=fn};sampleRUM.on=(chkpnt,fn)=>{sampleRUM.cases[chkpnt]=fn};defer("observe");defer("cwv");try{window.hlx=window.hlx||{};if(!window.hlx.rum){const usp=new URLSearchParams(window.location.search);const weight=usp.get("rum")==="on"?1:20;const id=Array.from({length:75},((_,i)=>String.fromCharCode(48+i))).filter((a=>/\d|[A-Z]/i.test(a))).filter((()=>Math.random()*75>70)).join("");const random=Math.random();const isSelected=random*weight<1;const firstReadTime=Date.now();const urlSanitizers={full:()=>window.location.href,origin:()=>window.location.origin,path:()=>window.location.href.replace(/\?.*$/,"")};window.hlx.rum={weight:weight,id:id,random:random,isSelected:isSelected,firstReadTime:firstReadTime,sampleRUM:sampleRUM,sanitizeURL:urlSanitizers[window.hlx.RUM_MASK_URL||"path"]}}const{weight:weight,id:id,firstReadTime:firstReadTime}=window.hlx.rum;if(window.hlx&&window.hlx.rum&&window.hlx.rum.isSelected){const knownProperties=["weight","id","referer","checkpoint","t","source","target","cwv","CLS","FID","LCP","INP"];const sendPing=(pdata=data)=>{const body=JSON.stringify({weight:weight,id:id,referer:window.hlx.rum.sanitizeURL(),checkpoint:checkpoint,t:Date.now()-firstReadTime,...data},knownProperties);const url=`https://rum.hlx.page/.rum/${weight}`;navigator.sendBeacon(url,body);console.debug(`ping:${checkpoint}`,pdata)};sampleRUM.cases=sampleRUM.cases||{cwv:()=>sampleRUM.cwv(data)||true,lazy:()=>{const script=document.createElement("script");script.src="https://rum.hlx.page/.rum/@adobe/helix-rum-enhancer@^1/src/index.js";document.head.appendChild(script);return true}};sendPing(data);if(sampleRUM.cases[checkpoint]){sampleRUM.cases[checkpoint]()}}if(sampleRUM.always[checkpoint]){sampleRUM.always[checkpoint](data)}}catch(error){}}export async function loadCSS(href){return new Promise(((resolve,reject)=>{if(!document.querySelector(`head > link[href="${href}"]`)){const link=document.createElement("link");link.rel="stylesheet";link.href=href;link.onload=resolve;link.onerror=reject;document.head.append(link)}else{resolve()}}))}export async function loadScript(src,attrs){return new Promise(((resolve,reject)=>{if(!document.querySelector(`head > script[src="${src}"]`)){const script=document.createElement("script");script.src=src;if(attrs){for(const attr in attrs){script.setAttribute(attr,attrs[attr])}}script.onload=resolve;script.onerror=reject;document.head.append(script)}else{resolve()}}))}export function getMetadata(name){const attr=name&&name.includes(":")?"property":"name";const meta=[...document.head.querySelectorAll(`meta[${attr}="${name}"]`)].map((m=>m.content)).join(", ");return meta||""}export function toClassName(name){return typeof name==="string"?name.toLowerCase().replace(/[^0-9a-z]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}export function toCamelCase(name){return toClassName(name).replace(/-([a-z])/g,(g=>g[1].toUpperCase()))}export function getAllMetadata(scope){return[...document.head.querySelectorAll(`meta[property^="${scope}:"],meta[name^="${scope}-"]`)].reduce(((res,meta)=>{const id=toClassName(meta.name?meta.name.substring(scope.length+1):meta.getAttribute("property").split(":")[1]);res[id]=meta.getAttribute("content");return res}),{})}const ICONS_CACHE={};export async function decorateIcons(element){let svgSprite=document.getElementById("franklin-svg-sprite");if(!svgSprite){const div=document.createElement("div");div.innerHTML='';svgSprite=div.firstElementChild;document.body.append(div.firstElementChild)}const icons=[...element.querySelectorAll("span.icon")];await Promise.all(icons.map((async span=>{const iconName=Array.from(span.classList).find((c=>c.startsWith("icon-"))).substring(5);if(!ICONS_CACHE[iconName]){ICONS_CACHE[iconName]=true;try{let iconSource=`${window.hlx.codeBasePath}/icons/${iconName}.svg`;if(iconName.startsWith("dam-")){const isPublicDomain=window.location.hostname.includes("lifesciences.danaher.com");iconSource=isPublicDomain?"":"https://lifesciences.danaher.com";iconSource+=`/content/dam/danaher/system/icons/${iconName.substring(4).replace("_"," ")}.svg`}const response=await fetch(iconSource);if(!response.ok){ICONS_CACHE[iconName]=false;return}const svg=await response.text();if(svg.match(/(