@salesforcedevs/docs-components
Advanced tools
Comparing version 1.3.227 to 1.3.228-version-picker1
@@ -20,2 +20,3 @@ { | ||
"doc/phase", | ||
"doc/versionPicker", | ||
"doc/xmlContent", | ||
@@ -22,0 +23,0 @@ "docUtils/utils" |
{ | ||
"name": "@salesforcedevs/docs-components", | ||
"version": "1.3.227", | ||
"version": "1.3.228-version-picker1", | ||
"description": "Docs Lightning web components for DSC", | ||
@@ -27,3 +27,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "ca4d2f11924db69bc1e872fb61587af9bb78cdde" | ||
"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,4 @@ AmfConfig, | ||
@api tocOptions?: string; | ||
@api languages!: OptionWithLink[]; | ||
@api language!: string; | ||
@track navigation = [] as NavigationItem[]; | ||
@@ -123,2 +126,4 @@ @track versions: Array<ReferenceVersion> = []; | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -206,2 +211,4 @@ } | ||
private isVersionFetched = false; | ||
@track | ||
private latestVersion = false; | ||
@@ -1317,2 +1324,4 @@ /** | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -1319,0 +1328,0 @@ |
@@ -7,2 +7,3 @@ /* eslint-disable @lwc/lwc/no-document-query */ | ||
import { SearchSyncer } from "docUtils/searchSyncer"; | ||
import type { OptionWithLink } from "typings/custom"; | ||
@@ -40,2 +41,6 @@ type AnchorMap = { [key: string]: { intersect: boolean; id: string } }; | ||
@api useOldSidebar?: boolean = false; | ||
@api languages!: OptionWithLink[]; | ||
@api language!: string; | ||
@api bailHref!: string; | ||
@api bailLabel!: string; | ||
@@ -42,0 +47,0 @@ @api |
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"; | ||
@@ -26,27 +23,3 @@ 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; | ||
@@ -64,20 +37,2 @@ 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 { | ||
@@ -91,10 +46,2 @@ super.connectedCallback(); | ||
this.smallMobileMatchMedia = window.matchMedia( | ||
`(max-width: ${SMALL_MOBILE_MATCH})` | ||
); | ||
this.onSmallMobileChange(this.smallMobileMatchMedia); | ||
this.smallMobileMatchMedia.addEventListener( | ||
"change", | ||
this.onSmallMobileChange | ||
); | ||
if ( | ||
@@ -118,7 +65,2 @@ (window.location.pathname.includes("/docs/") && | ||
); | ||
this.smallMobileMatchMedia.removeEventListener( | ||
"change", | ||
this.onSmallMobileChange | ||
); | ||
} | ||
@@ -129,5 +71,2 @@ | ||
private onSmallMobileChange = (e: MediaQueryListEvent | MediaQueryList) => | ||
(this.smallMobile = e.matches); | ||
protected additionalClasses(): string { | ||
@@ -139,32 +78,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<{ | ||
@@ -69,2 +76,3 @@ isFetchingDocument: boolean; | ||
private loaded = false; | ||
private _pageHeader?: Header; | ||
private pdfUrl = ""; | ||
@@ -76,5 +84,7 @@ private tocMap: TocMap = {}; | ||
private _pathName = ""; | ||
private _pageHeader?: Header; | ||
private listenerAttached = false; | ||
private _enableCoveo?: boolean = false; | ||
private sidebarFooterContent: SiderbarFooter = { ...defaultSidebarFooter }; | ||
@track | ||
private latestVersion = false; | ||
@@ -221,9 +231,2 @@ private searchSyncer = new SearchSyncer({ | ||
this.searchSyncer.dispose(); | ||
if (this.listenerAttached) { | ||
this.pageHeader.removeEventListener( | ||
"langchange", | ||
this.handleLanguageChange | ||
); | ||
this.listenerAttached = false; | ||
} | ||
} | ||
@@ -422,8 +425,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("/"); | ||
@@ -478,3 +477,3 @@ const { origin: domain, hash, search } = window.location; | ||
this.updateHeader(); | ||
this.updateHeaderAndSidebarFooter(); | ||
@@ -490,2 +489,4 @@ this.buildBreadcrumbs(); | ||
this.showVersionBanner = true; | ||
} else { | ||
this.latestVersion = true; | ||
} | ||
@@ -544,3 +545,3 @@ | ||
updateHeader(): void { | ||
updateHeaderAndSidebarFooter(): void { | ||
if (!this.pageHeader) { | ||
@@ -555,17 +556,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) { | ||
@@ -594,16 +587,10 @@ 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( | ||
@@ -610,0 +597,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
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
75
0
250675
6439
2