@salesforcedevs/docs-components 1.28.7-alpha.8 → 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 CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.28.7-alpha.8",
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": "20.x"
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": "e0ed02338af544308c36882f3b23049b126c6c9d"
32
+ "gitHead": "7874e944643e2f47606634d9d62ca585cefde113"
29
33
  }
@@ -1,17 +1,6 @@
1
1
  <template>
2
2
  <div class="content">
3
- <dx-sidebar
4
- lwc:if={showDataCloudSidebar}
5
- class="is-sticky left-nav-bar"
6
- trees={sidebarContent}
7
- value={sidebarValue}
8
- header={sidebarHeader}
9
- ontogglesidebar={onToggleSidebar}
10
- >
11
- <slot name="sidebar-header" slot="version-picker"></slot>
12
- </dx-sidebar>
13
3
  <dx-sidebar-old
14
- lwc:else
15
4
  class="is-sticky left-nav-bar"
16
5
  trees={sidebarContent}
17
6
  value={sidebarValue}
@@ -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,17 +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
111
  @track
118
112
  protected _sidebarContent: unknown;
119
113
 
120
- @track
121
- protected hasDataCloudResults: boolean | null = null;
122
-
123
114
  protected _breadcrumbs = null;
124
115
 
125
116
  @track
@@ -190,11 +181,6 @@ export default class ContentLayout extends LightningElement {
190
181
  }
191
182
 
192
183
  connectedCallback(): void {
193
- if (!this.useOldSidebar) {
194
- fetchHasResults().then((hasResults: boolean) => {
195
- this.hasDataCloudResults = hasResults;
196
- });
197
- }
198
184
  const hasParentHighlightListener = closest(
199
185
  "doc-xml-content",
200
186
  this.template.host
@@ -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 metadescription = document.querySelector(
772
+ const canonicalLink = document.querySelector(
759
773
  'link[rel="canonical"]'
760
774
  );
761
- if (metadescription) {
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
- metadescription.setAttribute(
767
- "href",
768
- window.location.protocol +
769
- "//" +
770
- window.location.host +
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