@salesforcedevs/docs-components
Advanced tools
Comparing version 1.3.228-version-picker3 to 1.3.242
@@ -20,3 +20,2 @@ { | ||
"doc/phase", | ||
"doc/versionPicker", | ||
"doc/xmlContent", | ||
@@ -23,0 +22,0 @@ "docUtils/utils" |
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.228-version-picker3", | ||
"version": "1.3.242", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -27,3 +27,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad" | ||
"gitHead": "f53c5d4c4cf5fe27cc7c9cb520d2a93f8bc82973" | ||
} |
@@ -7,3 +7,2 @@ import { LightningElement, api, track } from "lwc"; | ||
import { normalizeBoolean, toJson } from "dxUtils/normalizers"; | ||
import type { OptionWithLink } from "typings/custom"; | ||
import type { | ||
@@ -52,4 +51,2 @@ AmfConfig, | ||
@api tocOptions?: string; | ||
@api languages!: OptionWithLink[]; | ||
@api language!: string; | ||
@track navigation = [] as NavigationItem[]; | ||
@@ -126,4 +123,2 @@ @track versions: Array<ReferenceVersion> = []; | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -211,3 +206,2 @@ } | ||
private isVersionFetched = false; | ||
private latestVersion = false; | ||
@@ -1323,4 +1317,2 @@ /** | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -1327,0 +1319,0 @@ |
@@ -7,3 +7,2 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
import { SearchSyncer } from "docUtils/searchSyncer"; | ||
import type { OptionWithLink } from "typings/custom"; | ||
@@ -41,6 +40,2 @@ type AnchorMap = { [key: string]: { intersect: boolean; id: string } }; | ||
@api useOldSidebar?: boolean = false; | ||
@api languages!: OptionWithLink[]; | ||
@api language!: string; | ||
@api bailHref!: string; | ||
@api bailLabel!: string; | ||
@@ -47,0 +42,0 @@ @api |
import { api } from "lwc"; | ||
import cx from "classnames"; | ||
import type { OptionWithNested } from "typings/custom"; | ||
import type { OptionWithNested, OptionWithLink } 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"; | ||
@@ -23,3 +26,27 @@ 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; | ||
@@ -37,2 +64,20 @@ private tabletMatchMedia!: MediaQueryList; | ||
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 { | ||
@@ -46,2 +91,10 @@ super.connectedCallback(); | ||
this.smallMobileMatchMedia = window.matchMedia( | ||
`(max-width: ${SMALL_MOBILE_MATCH})` | ||
); | ||
this.onSmallMobileChange(this.smallMobileMatchMedia); | ||
this.smallMobileMatchMedia.addEventListener( | ||
"change", | ||
this.onSmallMobileChange | ||
); | ||
if ( | ||
@@ -65,2 +118,7 @@ (window.location.pathname.includes("/docs/") && | ||
); | ||
this.smallMobileMatchMedia.removeEventListener( | ||
"change", | ||
this.onSmallMobileChange | ||
); | ||
} | ||
@@ -71,2 +129,5 @@ | ||
private onSmallMobileChange = (e: MediaQueryListEvent | MediaQueryList) => | ||
(this.smallMobile = e.matches); | ||
protected additionalClasses(): string { | ||
@@ -78,2 +139,32 @@ 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,6 +64,2 @@ export type CoveoAdvancedQueryXMLConfig = { | ||
subtitle: string; | ||
headerHref: string; | ||
} | ||
export type SiderbarFooter = { | ||
bailHref: string; | ||
@@ -73,3 +69,4 @@ bailLabel: string; | ||
language?: string; | ||
}; | ||
headerHref: string; | ||
} | ||
@@ -76,0 +73,0 @@ export type ApiNavItem = { |
@@ -11,3 +11,2 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
Header, | ||
SiderbarFooter, | ||
HistoryState, | ||
@@ -31,8 +30,2 @@ PageReference, | ||
const defaultSidebarFooter: SiderbarFooter = { | ||
bailHref: "", | ||
bailLabel: "", | ||
languages: [], | ||
language: "" | ||
}; | ||
export default class DocXmlContent extends LightningElementWithState<{ | ||
@@ -76,3 +69,2 @@ isFetchingDocument: boolean; | ||
private loaded = false; | ||
private _pageHeader?: Header; | ||
private pdfUrl = ""; | ||
@@ -84,7 +76,5 @@ 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; | ||
@@ -144,6 +134,2 @@ private searchSyncer = new SearchSyncer({ | ||
info = oldVersionDocInfo(currentGAVersion.link.href); | ||
} else if ( | ||
parseFloat(this.version.id) > parseFloat(versionNo) | ||
) { | ||
this.previewVersion = true; | ||
} | ||
@@ -236,2 +222,9 @@ } catch (exception) { | ||
this.searchSyncer.dispose(); | ||
if (this.listenerAttached) { | ||
this.pageHeader.removeEventListener( | ||
"langchange", | ||
this.handleLanguageChange | ||
); | ||
this.listenerAttached = false; | ||
} | ||
} | ||
@@ -430,4 +423,8 @@ | ||
getReferenceFromUrl(): PageReference { | ||
const [page, docId, deliverable, contentDocumentId] = | ||
window.location.pathname.substr(1).split("/"); | ||
const [ | ||
page, | ||
docId, | ||
deliverable, | ||
contentDocumentId | ||
] = window.location.pathname.substr(1).split("/"); | ||
@@ -482,3 +479,3 @@ const { origin: domain, hash, search } = window.location; | ||
this.updateHeaderAndSidebarFooter(); | ||
this.updateHeader(); | ||
@@ -494,4 +491,2 @@ this.buildBreadcrumbs(); | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -550,3 +545,3 @@ | ||
updateHeaderAndSidebarFooter(): void { | ||
updateHeader(): void { | ||
if (!this.pageHeader) { | ||
@@ -561,9 +556,17 @@ return; | ||
if (this.pdfUrl) { | ||
this.sidebarFooterContent.bailHref = this.pdfUrl; | ||
this.sidebarFooterContent.bailLabel = "PDF"; | ||
this.pageHeader.bailHref = this.pdfUrl; | ||
this.pageHeader.bailLabel = "PDF"; | ||
} | ||
this.sidebarFooterContent.languages = this.availableLanguages; | ||
this.sidebarFooterContent.language = this.language?.id; | ||
if (!this.listenerAttached) { | ||
this.pageHeader.addEventListener( | ||
"langchange", | ||
this.handleLanguageChange | ||
); | ||
this.listenerAttached = true; | ||
} | ||
this.pageHeader.languages = this.availableLanguages; | ||
this.pageHeader.language = this.language?.id; | ||
if (this.pageReference) { | ||
@@ -592,10 +595,16 @@ const { docId, deliverable, page } = this.pageReference; | ||
private updateSearchInput(searchParam: string): void { | ||
( | ||
this.template.querySelector("doc-content-layout") as any | ||
)?.setSidebarInputValue(searchParam); | ||
(this.template.querySelector( | ||
"doc-content-layout" | ||
) 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( | ||
@@ -602,0 +611,0 @@ search! |
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
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
SPDX disjunction
LicenseSPDX disjunction for an artifact's license information
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
252751
1
0
73
2
6440