import { LightningElement, api } from "lwc"; export default class FooterMfe extends LightningElement { private footerElement: HTMLElement | null = null; @api legalOnly = false; @api homeHref: string = `/${window.location.host}`; // ugly hack by default: ideally this wouldn't be necessary, but the only way to remove the "See all ways to contact us" link from the footer MFE is to set this to a non-empty value other than "us"; and given the way that the footer works, the non-empty value needs to be something that can be appended to `/` and work correctly @api origin: string = `${window.location.origin}/developer/en-us/wp-json`; renderedCallback() { // Since the footer is a third-party component, we need to create it dynamically (LWC won't recognize it as a valid component). if (this.footerElement) { return; } this.footerElement = document.createElement("hgf-footer"); this.footerElement.setAttribute("origin", this.origin); this.footerElement.setAttribute("hide-language-selector", "true"); this.footerElement.setAttribute("home-href", this.homeHref); if (this.legalOnly) { this.footerElement.setAttribute("legal-only", "true"); } this.template.querySelector("div")!.appendChild(this.footerElement); } }