@salesforcedevs/docs-components 1.14.8-alpha6 → 1.14.8-ldh-alpha

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.14.8-alpha6",
3
+ "version": "1.14.8-ldh-alpha",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -48,7 +48,7 @@
48
48
  </header>
49
49
  </dx-brand-theme-provider>
50
50
  </template>
51
- <template lwc:if={showDocDivider}>
51
+ <template lwc:if={isHideHeader}>
52
52
  <div class="no-header-content"></div>
53
53
  </template>
54
54
  </template>
@@ -17,6 +17,7 @@ const isStorybook = () => {
17
17
  export default class Header extends HeaderBase {
18
18
  @api langValuePath: string = "id"; // allows to override how language property is interpreted, follows valuePath dropdown api.
19
19
  @api headerHref: string = "/";
20
+ @api hideDocHeader: boolean = false;
20
21
 
21
22
  @api
22
23
  get scopedNavItems() {
@@ -51,6 +52,10 @@ export default class Header extends HeaderBase {
51
52
  return this.scopedNavItems && this.scopedNavItems.length > 0;
52
53
  }
53
54
 
55
+ private get isHideHeader(): boolean {
56
+ return this.hideDocHeader || this.showDocDivider;
57
+ }
58
+
54
59
  connectedCallback(): void {
55
60
  super.connectedCallback();
56
61
  this.tabletMatchMedia = window.matchMedia(
@@ -60,7 +65,8 @@ export default class Header extends HeaderBase {
60
65
  this.tabletMatchMedia.addEventListener("change", this.onTabletChange);
61
66
 
62
67
  if (
63
- (window.location.pathname.includes("/docs/") &&
68
+ (!this.isHideHeader &&
69
+ window.location.pathname.includes("/docs/") &&
64
70
  window.location.pathname !== "/docs/apis") ||
65
71
  window.location.pathname ===
66
72
  "/tableau/embedding-playground/overview" ||
@@ -69,7 +75,11 @@ export default class Header extends HeaderBase {
69
75
  this.shouldRender = true;
70
76
  }
71
77
 
72
- if (this.shouldRender && window.location.pathname.includes("/docs/")) {
78
+ if (
79
+ !this.isHideHeader &&
80
+ this.shouldRender &&
81
+ window.location.pathname.includes("/docs/")
82
+ ) {
73
83
  if (!this.brand && !this.mobile) {
74
84
  this.shouldRender = false;
75
85
  this.showDocDivider = true;
@@ -11,6 +11,8 @@
11
11
  language={language}
12
12
  bail-href={bailHref}
13
13
  bail-label={bailLabel}
14
+ dev-center={devCenter}
15
+ brand={brand}
14
16
  >
15
17
  <slot name="sidebar-header" slot="version-picker"></slot>
16
18
  </dx-sidebar-old>
@@ -30,6 +32,8 @@
30
32
  language={language}
31
33
  bail-href={bailHref}
32
34
  bail-label={bailLabel}
35
+ dev-center={devCenter}
36
+ brand={brand}
33
37
  >
34
38
  <slot name="sidebar-header" slot="version-picker"></slot>
35
39
  </dx-sidebar>
@@ -1,3 +1,5 @@
1
+ /* eslint-disable @lwc/lwc/no-document-query */
2
+ import { api } from "lwc";
1
3
  import ContentLayout from "doc/contentLayout";
2
4
 
3
5
  const TOC_HEADER_TAG = "doc-heading";
@@ -6,6 +8,8 @@ const SPECIFICATION_TAB_TITLE = "Specification";
6
8
  export const OBSERVER_ATTACH_WAIT_TIME = 500;
7
9
 
8
10
  export default class LwcContentLayout extends ContentLayout {
11
+ @api devCenter: any;
12
+ @api brand: any;
9
13
  private rnbByTab: boolean = false;
10
14
 
11
15
  private setRNBByTab() {
@@ -21,7 +21,6 @@ export default class Nav extends LightningElement {
21
21
  @api pageReference!: PageReference;
22
22
 
23
23
  handleSelected(event: CustomEvent) {
24
- event.preventDefault();
25
24
  event.stopPropagation();
26
25
  const newPageReference = { ...this.pageReference };
27
26
  const target = event.detail.name.split("-");
@@ -38,11 +38,9 @@ export class FetchContent {
38
38
  pdf_url,
39
39
  deliverable
40
40
  } = await this.fetchResource<ApiDocData>(
41
- `/cx-router/dsc/toc?projectId=sfdocs-asl_dev_guide&projectVersion=254-7-dev&locale=en-us`
41
+ `${this.apiDomain}/docs/get_document/${docId}`
42
42
  );
43
43
 
44
- console.log(docId);
45
-
46
44
  const { normalizedToc, tocMap } = this.normalizeToc(toc);
47
45
  return {
48
46
  availableLanguages:
@@ -72,24 +70,26 @@ export class FetchContent {
72
70
  deliverable: string,
73
71
  contentId: string,
74
72
  options: ContentApiOptions
75
- ): Promise<String> {
76
- return this.fetchResource<String>(
77
- `/cx-router/dsc/topic?projectId=sfdocs-asl_dev_guide&projectVersion=254-7-dev&locale=en-us&topic=${contentId}`
73
+ ): Promise<ContentData> {
74
+ return this.fetchResource<ContentData>(
75
+ `${this.apiDomain}/docs/get_document_content/${deliverable}/${contentId}/${options.language}/${options.version}`
78
76
  );
79
77
  }
80
78
 
81
79
  private async fetchResource<T>(url: string): Promise<T> {
82
80
  const response = await fetch(url);
83
- /*if (!response.ok) {
81
+ if (!response.ok) {
84
82
  throw new Error(response.statusText);
85
- }*/
83
+ }
86
84
 
87
85
  const json = await response.json();
88
86
 
89
- return json.response;
87
+ return json;
90
88
  }
91
89
 
92
- private normalizeToc(apiToc: Array<ApiNavItem>): {
90
+ private normalizeToc(
91
+ apiToc: Array<ApiNavItem>
92
+ ): {
93
93
  tocMap: { [key: string]: TreeNode };
94
94
  normalizedToc: Array<TreeNode>;
95
95
  } {
@@ -346,7 +346,6 @@ export default class DocXmlContent extends LightningElementWithState<{
346
346
  }
347
347
 
348
348
  handleSelect(event: CustomEvent<{ name: string }>): void {
349
- event.preventDefault();
350
349
  event.stopPropagation();
351
350
  const { name } = event.detail;
352
351
 
@@ -365,18 +364,15 @@ export default class DocXmlContent extends LightningElementWithState<{
365
364
  contentDocumentId,
366
365
  hash
367
366
  });
368
- this.updateUrl(HistoryState.PUSH_STATE);
369
- // Prevent default navigation
370
- event.preventDefault();
367
+ this.updateUrl();
371
368
  }
372
369
  }
373
370
 
374
371
  handleNavClick(event: CustomEvent<{ pageReference: PageReference }>): void {
375
- event.preventDefault();
376
372
  event.stopPropagation();
377
373
  const { pageReference } = event.detail;
378
374
  this.updatePageReference(pageReference);
379
- this.updateUrl(HistoryState.PUSH_STATE);
375
+ this.updateUrl();
380
376
  }
381
377
 
382
378
  handleLanguageChange = (event: any) => {
@@ -547,7 +543,7 @@ export default class DocXmlContent extends LightningElementWithState<{
547
543
  );
548
544
 
549
545
  if (data) {
550
- this.docContent = JSON.parse(data).content;
546
+ this.docContent = data.content;
551
547
  this.addMetatags();
552
548
 
553
549
  if (!this.pageReference.hash) {
@@ -584,14 +580,11 @@ export default class DocXmlContent extends LightningElementWithState<{
584
580
 
585
581
  updateUrl(method = HistoryState.PUSH_STATE): void {
586
582
  logCoveoPageView(this.coveoOrganizationId, this.coveoAnalyticsToken);
587
- const url = this.pageReferenceToString(this.pageReference);
588
583
  window.history[method](
589
584
  {},
590
585
  "docs",
591
- url
586
+ this.pageReferenceToString(this.pageReference)
592
587
  );
593
- // Prevent default navigation
594
- event?.preventDefault();
595
588
  }
596
589
 
597
590
  private updateHighlighting(searchParam: string): void {