@salesforcedevs/docs-components 1.20.6 → 1.20.7

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.20.6",
3
+ "version": "1.20.7",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -25,7 +25,7 @@
25
25
  "@types/lodash.orderby": "4.6.9",
26
26
  "@types/lodash.uniqby": "4.7.9"
27
27
  },
28
- "gitHead": "c46ebfccf4f9313336961195d9cd7f1fc92270c5",
28
+ "gitHead": "fffbef4d7b536a321824457c6a987e53830a78f1",
29
29
  "volta": {
30
30
  "node": "20.19.0",
31
31
  "yarn": "1.22.19"
@@ -9,6 +9,7 @@ import {
9
9
  } from "./utils";
10
10
  import type { TopicModel } from "./types";
11
11
  import { Json } from "typings/custom";
12
+ import { buildDocLinkClickHandler } from "dxUtils/analytics";
12
13
 
13
14
  const TABLE_SIZE_MATCH = "769px";
14
15
 
@@ -16,6 +17,15 @@ export default class AmfTopic extends LightningElement {
16
17
  private _model: TopicModel | undefined;
17
18
  private amf: Json;
18
19
  private type: string | undefined;
20
+ private handleLinkClick = buildDocLinkClickHandler();
21
+
22
+ disconnectedCallback(): void {
23
+ // Remove link click handler
24
+ const container = this.template.querySelector(".topic-container");
25
+ if (container) {
26
+ container.removeEventListener("click", this.handleLinkClick);
27
+ }
28
+ }
19
29
 
20
30
  @api
21
31
  get model(): TopicModel | undefined {
@@ -92,6 +102,12 @@ export default class AmfTopic extends LightningElement {
92
102
  }
93
103
  container?.appendChild(element as Node);
94
104
 
105
+ // Add click handler for all links in the dynamically loaded content
106
+ if (container) {
107
+ container.removeEventListener("click", this.handleLinkClick);
108
+ container.addEventListener("click", this.handleLinkClick);
109
+ }
110
+
95
111
  const isTabletOrDesktop = window.matchMedia(
96
112
  `(min-width: ${TABLE_SIZE_MATCH})`
97
113
  ).matches;
@@ -6,6 +6,7 @@ import Button from "dx/button";
6
6
  import { highlightTerms } from "dxUtils/highlight";
7
7
  import ContentCallout from "doc/contentCallout";
8
8
  import ContentMedia from "doc/contentMedia";
9
+ import { buildDocLinkClickHandler } from "dxUtils/analytics";
9
10
 
10
11
  const HIGHLIGHTABLE_SELECTOR = [
11
12
  "p",
@@ -160,6 +161,8 @@ export default class Content extends LightningElement {
160
161
  const anchorEls = divEl.querySelectorAll("a:not([href^='#'])");
161
162
 
162
163
  anchorEls.forEach((anchorEl: any) => {
164
+ // Add click handler to track link clicks
165
+ anchorEl.addEventListener("click", buildDocLinkClickHandler());
163
166
  if (
164
167
  anchorEl.textContent!.includes("Next →") ||
165
168
  anchorEl.textContent!.includes("← Previous")
@@ -1,10 +1,11 @@
1
1
  /* eslint-disable @lwc/lwc/no-document-query */
2
- import { LightningElement, api, track } from "lwc";
2
+ import { LightningElement, api } from "lwc";
3
3
  import { closest } from "kagekiri";
4
4
  import { toJson } from "dxUtils/normalizers";
5
5
  import { highlightTerms } from "dxUtils/highlight";
6
6
  import { SearchSyncer } from "docUtils/searchSyncer";
7
7
  import type { OptionWithLink } from "typings/custom";
8
+ import { buildDocLinkClickHandler } from "dxUtils/analytics";
8
9
 
9
10
  type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
10
11
 
@@ -80,12 +81,10 @@ export default class ContentLayout extends LightningElement {
80
81
  );
81
82
  }
82
83
 
83
- @track
84
84
  protected _sidebarContent: unknown;
85
85
 
86
86
  protected _breadcrumbs = null;
87
87
 
88
- @track
89
88
  protected _tocOptions!: Array<unknown>;
90
89
 
91
90
  protected tocOptionIdsSet = new Set();
@@ -119,6 +118,7 @@ export default class ContentLayout extends LightningElement {
119
118
  protected observerTimerId?: NodeJS.Timeout;
120
119
  protected didScrollToSelectedHash = false;
121
120
  protected _scrollInterval = 0;
121
+ protected handleLinkClick = buildDocLinkClickHandler();
122
122
 
123
123
  get showToc(): boolean {
124
124
  return this.tocOptions && this.tocOptions.length > 0;
@@ -147,6 +147,9 @@ export default class ContentLayout extends LightningElement {
147
147
  );
148
148
  this.searchSyncer.init();
149
149
  }
150
+
151
+ // Add click handler for all links
152
+ this.template.addEventListener("click", this.handleLinkClick);
150
153
  }
151
154
 
152
155
  // Placeholder for childs renderedCallback
@@ -188,6 +191,9 @@ export default class ContentLayout extends LightningElement {
188
191
  this.clearRenderObserverTimer();
189
192
 
190
193
  window.clearInterval(this._scrollInterval);
194
+
195
+ // Remove link click handler
196
+ this.template.removeEventListener("click", this.handleLinkClick);
191
197
  }
192
198
 
193
199
  restoreScroll() {