@salesforcedevs/docs-components 1.27.22-banner2 → 1.27.22-banner3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.27.22-
|
|
3
|
+
"version": "1.27.22-banner3",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "49710bbadab19e48d79fbdfd9dbffa27fbe393db"
|
|
29
29
|
}
|
|
@@ -17,6 +17,7 @@ import { LightningElementWithState } from "dxBaseElements/lightningElementWithSt
|
|
|
17
17
|
import { oldVersionDocInfo } from "docUtils/utils";
|
|
18
18
|
import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
|
|
19
19
|
import { track as trackGTM } from "dxUtils/analytics";
|
|
20
|
+
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
20
21
|
import DOMPurify from "dompurify";
|
|
21
22
|
|
|
22
23
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
@@ -48,6 +49,11 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
48
49
|
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer-mfe. */
|
|
49
50
|
@api origin: string | null = null;
|
|
50
51
|
|
|
52
|
+
/** Optional base URL for the canonical link (e.g. https://developer.salesforce.com). When set, used instead of window.location for the canonical href. */
|
|
53
|
+
@api baseUrl: string | null = null;
|
|
54
|
+
|
|
55
|
+
@api localeBannerEnabled = false;
|
|
56
|
+
|
|
51
57
|
@api
|
|
52
58
|
get allLanguages(): Array<Language> {
|
|
53
59
|
return this._allLanguages;
|
|
@@ -254,6 +260,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
254
260
|
}
|
|
255
261
|
|
|
256
262
|
private get showLocaleBanner(): boolean {
|
|
263
|
+
if (!normalizeBoolean(this.localeBannerEnabled)) {
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
257
266
|
if (!this.pageReference?.deliverable || this.localeBannerDismissed) {
|
|
258
267
|
return false;
|
|
259
268
|
}
|
|
@@ -812,21 +821,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
812
821
|
}
|
|
813
822
|
|
|
814
823
|
if (this.pageReference) {
|
|
815
|
-
const
|
|
824
|
+
const canonicalLink = document.querySelector(
|
|
816
825
|
'link[rel="canonical"]'
|
|
817
826
|
);
|
|
818
|
-
if (
|
|
827
|
+
if (canonicalLink) {
|
|
819
828
|
const copyPageReference = { ...this.pageReference };
|
|
820
829
|
copyPageReference.docId = copyPageReference.docId
|
|
821
830
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
822
831
|
: copyPageReference.docId;
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
this.pageReferenceToString(copyPageReference)
|
|
829
|
-
);
|
|
832
|
+
const path = this.pageReferenceToString(copyPageReference);
|
|
833
|
+
const origin = this.baseUrl
|
|
834
|
+
? this.baseUrl.replace(/\/$/, "")
|
|
835
|
+
: `${window.location.protocol}//${window.location.host}`;
|
|
836
|
+
canonicalLink.setAttribute("href", `${origin}${path}`);
|
|
830
837
|
}
|
|
831
838
|
}
|
|
832
839
|
|