@salesforcedevs/docs-components
Advanced tools
Comparing version 1.3.242 to 1.3.243-newdocux-alpha10
@@ -20,2 +20,3 @@ { | ||
"doc/phase", | ||
"doc/versionPicker", | ||
"doc/xmlContent", | ||
@@ -22,0 +23,0 @@ "docUtils/utils" |
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.242", | ||
"version": "1.3.243-newdocux-alpha10", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -27,3 +27,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "f53c5d4c4cf5fe27cc7c9cb520d2a93f8bc82973" | ||
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad" | ||
} |
@@ -7,2 +7,3 @@ import { LightningElement, api, track } from "lwc"; | ||
import { normalizeBoolean, toJson } from "dxUtils/normalizers"; | ||
import type { OptionWithLink } from "typings/custom"; | ||
import type { | ||
@@ -51,2 +52,5 @@ AmfConfig, | ||
@api tocOptions?: string; | ||
@api languages!: OptionWithLink[]; | ||
@api language!: string; | ||
@api hideFooter = false; | ||
@track navigation = [] as NavigationItem[]; | ||
@@ -123,2 +127,4 @@ @track versions: Array<ReferenceVersion> = []; | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -185,2 +191,6 @@ } | ||
private get enableFooter(): boolean { | ||
return !this.hideFooter; | ||
} | ||
// model | ||
@@ -207,2 +217,3 @@ protected _amfConfigList: AmfConfig[] = []; | ||
private isVersionFetched = false; | ||
private latestVersion = false; | ||
@@ -1318,2 +1329,4 @@ /** | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -1320,0 +1333,0 @@ |
@@ -7,2 +7,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
import { SearchSyncer } from "docUtils/searchSyncer"; | ||
import type { OptionWithLink } from "typings/custom"; | ||
@@ -40,3 +41,10 @@ type AnchorMap = { [key: string]: { intersect: boolean; id: string } }; | ||
@api useOldSidebar?: boolean = false; | ||
@api languages!: OptionWithLink[]; | ||
@api language!: string; | ||
@api bailHref!: string; | ||
@api bailLabel!: string; | ||
// This is needed for now to prevent failing snapshot tests due to links in the footer | ||
@api showFooter = false; | ||
@api | ||
@@ -43,0 +51,0 @@ get breadcrumbs() { |
import { api } from "lwc"; | ||
import cx from "classnames"; | ||
import type { OptionWithNested, OptionWithLink } from "typings/custom"; | ||
import type { OptionWithNested } from "typings/custom"; | ||
import { HeaderBase } from "dxBaseElements/headerBase"; | ||
import { toJson } from "dxUtils/normalizers"; | ||
import get from "lodash.get"; | ||
import { track } from "dxUtils/analytics"; | ||
const TABLET_MATCH = "980px"; | ||
const MOBILE_MATCH = "880px"; | ||
const SMALL_MOBILE_MATCH = "768px"; | ||
const MOBILE_MATCH = "768px"; | ||
@@ -26,30 +23,7 @@ export default class Header extends HeaderBase { | ||
@api | ||
get languages() { | ||
return this._languages; | ||
} | ||
set languages(value) { | ||
this._languages = toJson(value); | ||
} | ||
@api | ||
get language() { | ||
return this._language; | ||
} | ||
set language(value) { | ||
if (this._language !== value) { | ||
this._language = value; | ||
} | ||
} | ||
private _language: string | null = null; | ||
private _languages!: OptionWithLink[]; | ||
private _scopedNavItems!: OptionWithNested[]; | ||
private smallMobile = false; | ||
private smallMobileMatchMedia!: MediaQueryList; | ||
private tablet = false; | ||
private tabletMatchMedia!: MediaQueryList; | ||
private shouldRender = false; | ||
private shouldRender: boolean = false; | ||
private showDocDivider: boolean = false; | ||
@@ -64,20 +38,2 @@ protected mobileBreakpoint(): string { | ||
private get hasLanguages(): boolean { | ||
return !!(this.languages && this.languages.length); | ||
} | ||
private get showMobileLanguages(): boolean { | ||
return this.smallMobile && this.hasLanguages; | ||
} | ||
private get languageLabel(): string { | ||
return ( | ||
(this.language && | ||
this.languages.find( | ||
(lang) => get(lang, this.langValuePath) === this.language | ||
)?.label) || | ||
this.languages[0].label | ||
); | ||
} | ||
connectedCallback(): void { | ||
@@ -91,10 +47,2 @@ super.connectedCallback(); | ||
this.smallMobileMatchMedia = window.matchMedia( | ||
`(max-width: ${SMALL_MOBILE_MATCH})` | ||
); | ||
this.onSmallMobileChange(this.smallMobileMatchMedia); | ||
this.smallMobileMatchMedia.addEventListener( | ||
"change", | ||
this.onSmallMobileChange | ||
); | ||
if ( | ||
@@ -110,2 +58,9 @@ (window.location.pathname.includes("/docs/") && | ||
} | ||
if (this.shouldRender && window.location.pathname.includes("/docs/")) { | ||
if (!this.brand && !this.mobile) { | ||
this.shouldRender = false; | ||
this.showDocDivider = true; | ||
} | ||
} | ||
} | ||
@@ -119,7 +74,2 @@ | ||
); | ||
this.smallMobileMatchMedia.removeEventListener( | ||
"change", | ||
this.onSmallMobileChange | ||
); | ||
} | ||
@@ -130,5 +80,2 @@ | ||
private onSmallMobileChange = (e: MediaQueryListEvent | MediaQueryList) => | ||
(this.smallMobile = e.matches); | ||
protected additionalClasses(): string { | ||
@@ -140,32 +87,2 @@ return cx( | ||
} | ||
private onLangChange(event: CustomEvent<string>): void { | ||
const { detail } = event; | ||
this._language = detail; | ||
this.dispatchEvent(new CustomEvent("langchange", { detail })); | ||
} | ||
private handleBailClick(event: Event) { | ||
const payload = { | ||
click_text: "pdf", | ||
click_url: this.bailHref, | ||
element_title: "pdf", | ||
element_type: "link", | ||
content_category: "download" | ||
}; | ||
track(event.target!, "custEv_pdfDownload", { | ||
...payload, | ||
file_name: this.getFilename(this.bailHref!), | ||
file_extension: "pdf" | ||
}); | ||
track(event.target!, "custEv_linkClick", { | ||
...payload | ||
}); | ||
} | ||
private getFilename = function (path: string) { | ||
return path.substring(path.lastIndexOf("/") + 1); | ||
}; | ||
} |
@@ -64,2 +64,6 @@ export type CoveoAdvancedQueryXMLConfig = { | ||
subtitle: string; | ||
headerHref: string; | ||
} | ||
export type SiderbarFooter = { | ||
bailHref: string; | ||
@@ -69,4 +73,3 @@ bailLabel: string; | ||
language?: string; | ||
headerHref: string; | ||
} | ||
}; | ||
@@ -73,0 +76,0 @@ export type ApiNavItem = { |
@@ -11,2 +11,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
Header, | ||
SiderbarFooter, | ||
HistoryState, | ||
@@ -30,2 +31,8 @@ PageReference, | ||
const defaultSidebarFooter: SiderbarFooter = { | ||
bailHref: "", | ||
bailLabel: "", | ||
languages: [], | ||
language: "" | ||
}; | ||
export default class DocXmlContent extends LightningElementWithState<{ | ||
@@ -42,2 +49,3 @@ isFetchingDocument: boolean; | ||
@api coveoSearchHub!: string; | ||
@api hideFooter = false; | ||
@@ -65,3 +73,3 @@ @api | ||
private availableLanguages: Array<DocLanguage> = []; | ||
private availableVersions: Array<DocVersion> = []; | ||
@track private availableVersions: Array<DocVersion> = []; | ||
private contentProvider?: FetchContent; | ||
@@ -71,2 +79,3 @@ private docContent = ""; | ||
private loaded = false; | ||
private _pageHeader?: Header; | ||
private pdfUrl = ""; | ||
@@ -78,6 +87,12 @@ private tocMap: TocMap = {}; | ||
private _pathName = ""; | ||
private _pageHeader?: Header; | ||
private listenerAttached = false; | ||
private _enableCoveo?: boolean = false; | ||
private sidebarFooterContent: SiderbarFooter = { ...defaultSidebarFooter }; | ||
private latestVersion = false; | ||
private previewVersion = false; | ||
private get enableFooter(): boolean { | ||
return !this.hideFooter; | ||
} | ||
private searchSyncer = new SearchSyncer({ | ||
@@ -136,2 +151,6 @@ callbacks: { | ||
info = oldVersionDocInfo(currentGAVersion.link.href); | ||
} else if ( | ||
parseFloat(this.version.id) > parseFloat(versionNo) | ||
) { | ||
this.previewVersion = true; | ||
} | ||
@@ -224,9 +243,2 @@ } catch (exception) { | ||
this.searchSyncer.dispose(); | ||
if (this.listenerAttached) { | ||
this.pageHeader.removeEventListener( | ||
"langchange", | ||
this.handleLanguageChange | ||
); | ||
this.listenerAttached = false; | ||
} | ||
} | ||
@@ -425,8 +437,4 @@ | ||
getReferenceFromUrl(): PageReference { | ||
const [ | ||
page, | ||
docId, | ||
deliverable, | ||
contentDocumentId | ||
] = window.location.pathname.substr(1).split("/"); | ||
const [page, docId, deliverable, contentDocumentId] = | ||
window.location.pathname.substr(1).split("/"); | ||
@@ -481,3 +489,3 @@ const { origin: domain, hash, search } = window.location; | ||
this.updateHeader(); | ||
this.updateHeaderAndSidebarFooter(); | ||
@@ -493,2 +501,4 @@ this.buildBreadcrumbs(); | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -547,3 +557,3 @@ | ||
updateHeader(): void { | ||
updateHeaderAndSidebarFooter(): void { | ||
if (!this.pageHeader) { | ||
@@ -558,17 +568,9 @@ return; | ||
if (this.pdfUrl) { | ||
this.pageHeader.bailHref = this.pdfUrl; | ||
this.pageHeader.bailLabel = "PDF"; | ||
this.sidebarFooterContent.bailHref = this.pdfUrl; | ||
this.sidebarFooterContent.bailLabel = "PDF"; | ||
} | ||
if (!this.listenerAttached) { | ||
this.pageHeader.addEventListener( | ||
"langchange", | ||
this.handleLanguageChange | ||
); | ||
this.listenerAttached = true; | ||
} | ||
this.sidebarFooterContent.languages = this.availableLanguages; | ||
this.sidebarFooterContent.language = this.language?.id; | ||
this.pageHeader.languages = this.availableLanguages; | ||
this.pageHeader.language = this.language?.id; | ||
if (this.pageReference) { | ||
@@ -597,16 +599,8 @@ const { docId, deliverable, page } = this.pageReference; | ||
private updateSearchInput(searchParam: string): void { | ||
(this.template.querySelector( | ||
"doc-content-layout" | ||
) as any)?.setSidebarInputValue(searchParam); | ||
(this.refs.docContentLayout as any)?.setSidebarInputValue(searchParam); | ||
} | ||
private pageReferenceToString(reference: PageReference): string { | ||
const { | ||
page, | ||
docId, | ||
deliverable, | ||
contentDocumentId, | ||
hash, | ||
search | ||
} = reference; | ||
const { page, docId, deliverable, contentDocumentId, hash, search } = | ||
reference; | ||
return `/${page}/${docId}/${deliverable}/${contentDocumentId}${this.normalizeSearch( | ||
@@ -796,2 +790,6 @@ search! | ||
} | ||
private get showVersionPicker(): boolean { | ||
return !this.disableVersion; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
253295
75
0
6494
2