@salesforcedevs/docs-components 1.28.7-alpha.9 → 1.30.1-node22-1
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 +7 -3
- package/src/modules/doc/contentLayout/contentLayout.html +16 -29
- package/src/modules/doc/contentLayout/contentLayout.ts +1 -24
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +1 -12
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +11 -0
- package/src/modules/doc/redocReference/redocReference.ts +11 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +21 -9
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.1-node22-1",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "
|
|
8
|
+
"node": ">=22.0.0"
|
|
9
|
+
},
|
|
10
|
+
"volta": {
|
|
11
|
+
"node": "22.22.0",
|
|
12
|
+
"yarn": "1.22.22"
|
|
9
13
|
},
|
|
10
14
|
"publishConfig": {
|
|
11
15
|
"access": "public"
|
|
@@ -25,5 +29,5 @@
|
|
|
25
29
|
"@types/lodash.orderby": "4.6.9",
|
|
26
30
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
31
|
},
|
|
28
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "7874e944643e2f47606634d9d62ca585cefde113"
|
|
29
33
|
}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="content">
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
header={sidebarHeader}
|
|
20
|
-
ontogglesidebar={onToggleSidebar}
|
|
21
|
-
languages={languages}
|
|
22
|
-
language={language}
|
|
23
|
-
bail-href={bailHref}
|
|
24
|
-
bail-label={bailLabel}
|
|
25
|
-
dev-center={devCenter}
|
|
26
|
-
brand={brand}
|
|
27
|
-
empty-state-message={emptyStateMessage}
|
|
28
|
-
>
|
|
29
|
-
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
30
|
-
</dx-sidebar-old>
|
|
31
|
-
</template>
|
|
3
|
+
<dx-sidebar-old
|
|
4
|
+
class="is-sticky left-nav-bar"
|
|
5
|
+
trees={sidebarContent}
|
|
6
|
+
value={sidebarValue}
|
|
7
|
+
header={sidebarHeader}
|
|
8
|
+
ontogglesidebar={onToggleSidebar}
|
|
9
|
+
languages={languages}
|
|
10
|
+
language={language}
|
|
11
|
+
bail-href={bailHref}
|
|
12
|
+
bail-label={bailLabel}
|
|
13
|
+
dev-center={devCenter}
|
|
14
|
+
brand={brand}
|
|
15
|
+
empty-state-message={emptyStateMessage}
|
|
16
|
+
>
|
|
17
|
+
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
18
|
+
</dx-sidebar-old>
|
|
32
19
|
<div class="content-body-doc-phase-container">
|
|
33
20
|
<div class="doc-phase-wrapper">
|
|
34
21
|
<slot name="doc-phase"></slot>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @lwc/lwc/no-document-query */
|
|
2
2
|
import { LightningElement, api, track } from "lwc";
|
|
3
3
|
import { closest } from "kagekiri";
|
|
4
|
-
import { fetchHasResults } from "dxUtils/dataCloudSearch";
|
|
5
4
|
import { toJson, normalizeBoolean } from "dxUtils/normalizers";
|
|
6
5
|
import { highlightTerms } from "dxUtils/highlight";
|
|
7
6
|
import { SearchSyncer } from "docUtils/searchSyncer";
|
|
@@ -109,24 +108,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
109
108
|
);
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
/** Show Data Cloud sidebar only when not using old sidebar and the page has searchable results. */
|
|
113
|
-
protected get showDataCloudSidebar(): boolean {
|
|
114
|
-
return !this.useOldSidebar && this.hasDataCloudResults === true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** Show legacy sidebar when explicitly requested or when Data Cloud has no results. Don't show until we know (avoids flash). */
|
|
118
|
-
protected get showOldSidebar(): boolean {
|
|
119
|
-
return (
|
|
120
|
-
this.useOldSidebar === true || this.hasDataCloudResults === false
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
111
|
@track
|
|
125
112
|
protected _sidebarContent: unknown;
|
|
126
113
|
|
|
127
|
-
@track
|
|
128
|
-
protected hasDataCloudResults: boolean | null = null;
|
|
129
|
-
|
|
130
114
|
protected _breadcrumbs = null;
|
|
131
115
|
|
|
132
116
|
@track
|
|
@@ -197,11 +181,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
197
181
|
}
|
|
198
182
|
|
|
199
183
|
connectedCallback(): void {
|
|
200
|
-
if (!this.useOldSidebar) {
|
|
201
|
-
fetchHasResults().then((hasResults: boolean) => {
|
|
202
|
-
this.hasDataCloudResults = hasResults;
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
184
|
const hasParentHighlightListener = closest(
|
|
206
185
|
"doc-xml-content",
|
|
207
186
|
this.template.host
|
|
@@ -278,9 +257,7 @@ export default class ContentLayout extends LightningElement {
|
|
|
278
257
|
We have to account for the global nav changing height due to animations.
|
|
279
258
|
*/
|
|
280
259
|
adjustNavPosition = () => {
|
|
281
|
-
const sidebarEl =
|
|
282
|
-
this.template.querySelector("dx-sidebar") ||
|
|
283
|
-
this.template.querySelector("dx-sidebar-old");
|
|
260
|
+
const sidebarEl = this.template.querySelector("dx-sidebar-old");
|
|
284
261
|
const globalNavEl = document.querySelector(
|
|
285
262
|
"hgf-c360nav"
|
|
286
263
|
) as HTMLElement;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="content">
|
|
3
3
|
<dx-sidebar-old
|
|
4
|
-
lwc:if={useOldSidebar}
|
|
5
4
|
class="is-sticky left-nav-bar"
|
|
6
5
|
trees={sidebarContent}
|
|
7
6
|
value={sidebarValue}
|
|
@@ -16,16 +15,6 @@
|
|
|
16
15
|
>
|
|
17
16
|
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
18
17
|
</dx-sidebar-old>
|
|
19
|
-
<dx-sidebar
|
|
20
|
-
lwc:else
|
|
21
|
-
class="is-sticky left-nav-bar"
|
|
22
|
-
trees={sidebarContent}
|
|
23
|
-
value={sidebarValue}
|
|
24
|
-
header={sidebarHeader}
|
|
25
|
-
ontogglesidebar={onToggleSidebar}
|
|
26
|
-
>
|
|
27
|
-
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
28
|
-
</dx-sidebar>
|
|
29
18
|
<div class="content-body-doc-phase-container">
|
|
30
19
|
<div class="doc-phase-wrapper">
|
|
31
20
|
<slot name="doc-phase"></slot>
|
|
@@ -68,7 +57,7 @@
|
|
|
68
57
|
</div>
|
|
69
58
|
</div>
|
|
70
59
|
<div lwc:if={showFooter} class="footer-container">
|
|
71
|
-
<dx-footer variant="no-signup"></dx-footer>
|
|
60
|
+
<dx-footer variant="no-signup" mfe-config-origin={effectiveFooterOrigin}></dx-footer>
|
|
72
61
|
</div>
|
|
73
62
|
</div>
|
|
74
63
|
</div>
|
|
@@ -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;
|
|
@@ -251,6 +254,17 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
251
254
|
return this.pageReference.deliverable;
|
|
252
255
|
}
|
|
253
256
|
|
|
257
|
+
private get useOldSidebar(): boolean {
|
|
258
|
+
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
259
|
+
// TODO: we need a better fix for version number check
|
|
260
|
+
return !(
|
|
261
|
+
!this.version?.releaseVersion ||
|
|
262
|
+
(this.version?.releaseVersion &&
|
|
263
|
+
parseInt(this.version.releaseVersion.replace("v", ""), 10) >=
|
|
264
|
+
53)
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
254
268
|
private get pageHeader(): Header {
|
|
255
269
|
if (!this._pageHeader) {
|
|
256
270
|
this._pageHeader = document.querySelector("doc-header")!;
|
|
@@ -755,21 +769,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
755
769
|
}
|
|
756
770
|
|
|
757
771
|
if (this.pageReference) {
|
|
758
|
-
const
|
|
772
|
+
const canonicalLink = document.querySelector(
|
|
759
773
|
'link[rel="canonical"]'
|
|
760
774
|
);
|
|
761
|
-
if (
|
|
775
|
+
if (canonicalLink) {
|
|
762
776
|
const copyPageReference = { ...this.pageReference };
|
|
763
777
|
copyPageReference.docId = copyPageReference.docId
|
|
764
778
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
765
779
|
: copyPageReference.docId;
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
this.pageReferenceToString(copyPageReference)
|
|
772
|
-
);
|
|
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}`);
|
|
773
785
|
}
|
|
774
786
|
}
|
|
775
787
|
|