@salesforcedevs/docs-components 1.27.23 → 1.28.0
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.
|
|
3
|
+
"version": "1.28.0",
|
|
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": "4027270163b2eb9610b911a09bfa31f536061fe4"
|
|
29
29
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { api } from "lwc";
|
|
1
2
|
import ContentLayout from "doc/contentLayout";
|
|
2
3
|
import cx from "classnames";
|
|
3
4
|
|
|
@@ -15,6 +16,16 @@ export default class LwcContentLayout extends ContentLayout {
|
|
|
15
16
|
private allTabsCache: any[] | null = null;
|
|
16
17
|
private mainSlotCache: any = null;
|
|
17
18
|
|
|
19
|
+
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer. */
|
|
20
|
+
@api origin: string | null = null;
|
|
21
|
+
|
|
22
|
+
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
23
|
+
get effectiveFooterOrigin(): string {
|
|
24
|
+
return (
|
|
25
|
+
this.origin ?? `${window.location.origin}/developer/en-us/wp-json`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
private setRNBByTab() {
|
|
19
30
|
const tabPanelListItem = this.getTabPanelList();
|
|
20
31
|
this.rnbByTab = tabPanelListItem?.id === RNB_BY_TAB;
|
|
@@ -68,6 +68,16 @@ export default class RedocReference extends LightningElement {
|
|
|
68
68
|
this._parentDocPhaseInfo = value;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer. */
|
|
72
|
+
@api origin: string | null = null;
|
|
73
|
+
|
|
74
|
+
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
75
|
+
get effectiveFooterOrigin(): string {
|
|
76
|
+
return (
|
|
77
|
+
this.origin ?? `${window.location.origin}/developer/en-us/wp-json`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
71
81
|
connectedCallback(): void {
|
|
72
82
|
window.addEventListener("scroll", this.handleScrollAndResize);
|
|
73
83
|
window.addEventListener("resize", this.handleScrollAndResize);
|
|
@@ -338,7 +348,7 @@ export default class RedocReference extends LightningElement {
|
|
|
338
348
|
// Appends footer component to container
|
|
339
349
|
private insertFooter(container: HTMLElement): void {
|
|
340
350
|
const footerElement = createElement("dx-footer", { is: DxFooter });
|
|
341
|
-
Object.assign(footerElement, { variant: "no-signup" });
|
|
351
|
+
Object.assign(footerElement, { variant: "no-signup", mfeConfigOrigin: this.effectiveFooterOrigin });
|
|
342
352
|
container.appendChild(footerElement);
|
|
343
353
|
}
|
|
344
354
|
|
|
@@ -48,6 +48,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
48
48
|
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer-mfe. */
|
|
49
49
|
@api origin: string | null = null;
|
|
50
50
|
|
|
51
|
+
/** Optional base URL for the canonical link (e.g. https://developer.salesforce.com). When set, used instead of window.location for the canonical href. */
|
|
52
|
+
@api baseUrl: string | null = null;
|
|
53
|
+
|
|
51
54
|
@api
|
|
52
55
|
get allLanguages(): Array<Language> {
|
|
53
56
|
return this._allLanguages;
|
|
@@ -766,21 +769,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
766
769
|
}
|
|
767
770
|
|
|
768
771
|
if (this.pageReference) {
|
|
769
|
-
const
|
|
772
|
+
const canonicalLink = document.querySelector(
|
|
770
773
|
'link[rel="canonical"]'
|
|
771
774
|
);
|
|
772
|
-
if (
|
|
775
|
+
if (canonicalLink) {
|
|
773
776
|
const copyPageReference = { ...this.pageReference };
|
|
774
777
|
copyPageReference.docId = copyPageReference.docId
|
|
775
778
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
776
779
|
: copyPageReference.docId;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
this.pageReferenceToString(copyPageReference)
|
|
783
|
-
);
|
|
780
|
+
const path = this.pageReferenceToString(copyPageReference);
|
|
781
|
+
const origin = this.baseUrl
|
|
782
|
+
? this.baseUrl.replace(/\/$/, "")
|
|
783
|
+
: `${window.location.protocol}//${window.location.host}`;
|
|
784
|
+
canonicalLink.setAttribute("href", `${origin}${path}`);
|
|
784
785
|
}
|
|
785
786
|
}
|
|
786
787
|
|