@salesforcedevs/docs-components 1.3.190 → 1.3.192

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.190",
3
+ "version": "1.3.192",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "497da468695115bb4b604763f8039aaf6b1cbc86"
27
+ "gitHead": "2f99b05c7c6a70442b1e373e3c41486a0b354ed8"
28
28
  }
@@ -27,7 +27,7 @@ import {
27
27
  } from "./constants";
28
28
  import { restoreScroll } from "dx/scrollManager";
29
29
  import { DocPhaseInfo } from "typings/custom";
30
- import { oldVersionDocInfo } from "docUtils/utils";
30
+ import { logCoveoPageView, oldVersionDocInfo } from "docUtils/utils";
31
31
 
32
32
  type NavigationItem = {
33
33
  label: string;
@@ -822,6 +822,7 @@ export default class AmfReference extends LightningElement {
822
822
  if (meta) {
823
823
  // update the encoded url meta param
824
824
  const encodedMeta = this.getUrlEncoded(meta);
825
+
825
826
  window.history.replaceState(
826
827
  window.history.state,
827
828
  "",
@@ -1155,6 +1156,7 @@ export default class AmfReference extends LightningElement {
1155
1156
  "",
1156
1157
  selectedItemMetaData.meta
1157
1158
  );
1159
+
1158
1160
  this.updateUrlWithSelected(
1159
1161
  selectedItemMetaData.parentReferencePath,
1160
1162
  selectedItemMetaData.meta
@@ -1198,6 +1200,9 @@ export default class AmfReference extends LightningElement {
1198
1200
  */
1199
1201
 
1200
1202
  private loadMarkdownBasedReference(referenceUrl?: string | null): void {
1203
+ // MILES TODO: figure out if we ever need to log a coveo page view in here
1204
+ // this would be the case if at some point we 'load' a new 'markdown based reference'
1205
+ // without actually triggering a page load
1201
1206
  let referenceId = "";
1202
1207
  const currentUrl = window.location.href;
1203
1208
  if (this.isProjectRootPath()) {
@@ -1278,6 +1283,7 @@ export default class AmfReference extends LightningElement {
1278
1283
  if (this.oldVersionInfo) {
1279
1284
  this.showVersionBanner = true;
1280
1285
  }
1286
+
1281
1287
  this.updateDocPhase();
1282
1288
  this.selectedSidebarValue = window.location.pathname;
1283
1289
  }
@@ -1341,6 +1347,11 @@ export default class AmfReference extends LightningElement {
1341
1347
  elementId,
1342
1348
  metaVal
1343
1349
  );
1350
+
1351
+ logCoveoPageView(
1352
+ this.coveoOrganizationId,
1353
+ this.coveoAnalyticsToken
1354
+ );
1344
1355
  this.updateUrlWithSelected(parentReferencePath, metaVal);
1345
1356
  this.updateNavTitleMetaTag(metadata.navTitle);
1346
1357
  } else {
@@ -4,7 +4,6 @@ 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
- import { CoveoAnalyticsClient } from "coveo.analytics";
8
7
 
9
8
  type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
10
9
 
@@ -37,7 +36,6 @@ export default class ContentLayout extends LightningElement {
37
36
  @api coveoSearchHub!: string;
38
37
  @api coveoAdvancedQueryConfig!: string;
39
38
  @api useOldSidebar?: boolean = false;
40
- @api logCoveoPageViewOnlyOnConnect: boolean = false;
41
39
 
42
40
  @api
43
41
  get breadcrumbs() {
@@ -130,19 +128,6 @@ export default class ContentLayout extends LightningElement {
130
128
  );
131
129
  }
132
130
 
133
- private logCoveoPageView() {
134
- if (this.coveoOrganizationId && this.coveoAnalyticsToken) {
135
- const ua = new CoveoAnalyticsClient({
136
- token: this.coveoAnalyticsToken,
137
- endpoint: `https://${this.coveoOrganizationId}.analytics.org.coveo.com`
138
- });
139
- ua.sendViewEvent({
140
- contentIdKey: "@clickableuri",
141
- contentIdValue: window.location.href
142
- });
143
- }
144
- }
145
-
146
131
  connectedCallback(): void {
147
132
  const hasParentHighlightListener = closest(
148
133
  "doc-xml-content",
@@ -155,9 +140,6 @@ export default class ContentLayout extends LightningElement {
155
140
  );
156
141
  this.searchSyncer.init();
157
142
  }
158
- if (this.logCoveoPageViewOnlyOnConnect) {
159
- this.logCoveoPageView();
160
- }
161
143
  }
162
144
 
163
145
  renderedCallback(): void {
@@ -178,8 +160,6 @@ export default class ContentLayout extends LightningElement {
178
160
  if (!this.hasRendered) {
179
161
  this.hasRendered = true;
180
162
  this.restoreScroll();
181
- } else if (!this.logCoveoPageViewOnlyOnConnect) {
182
- this.logCoveoPageView();
183
163
  }
184
164
  }
185
165
 
@@ -14,7 +14,7 @@ import {
14
14
  } from "./types";
15
15
  import { SearchSyncer } from "docUtils/searchSyncer";
16
16
  import { LightningElementWithState } from "dxBaseElements/lightningElementWithState";
17
- import { oldVersionDocInfo } from "docUtils/utils";
17
+ import { logCoveoPageView, oldVersionDocInfo } from "docUtils/utils";
18
18
  import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
19
19
  import { track as trackGTM } from "dxUtils/analytics";
20
20
 
@@ -558,6 +558,7 @@ export default class DocXmlContent extends LightningElementWithState<{
558
558
  }
559
559
 
560
560
  updateUrl(method = HistoryState.PUSH_STATE): void {
561
+ logCoveoPageView(this.coveoOrganizationId, this.coveoAnalyticsToken);
561
562
  window.history[method](
562
563
  {},
563
564
  "docs",
@@ -1,3 +1,5 @@
1
+ import { CoveoAnalyticsClient } from "coveo.analytics";
2
+
1
3
  export const oldVersionDocInfo = (latestVersionLink: string) => {
2
4
  return {
3
5
  title: "Newer Version Available",
@@ -5,3 +7,26 @@ export const oldVersionDocInfo = (latestVersionLink: string) => {
5
7
  <a style="font-weight: bold;" href="${latestVersionLink}">View Latest</a>`
6
8
  };
7
9
  };
10
+
11
+ export function logCoveoPageView(
12
+ coveoOrganizationId: string | undefined,
13
+ coveoAnalyticsToken: string | undefined
14
+ ) {
15
+ if (coveoOrganizationId && coveoAnalyticsToken) {
16
+ const ua = new CoveoAnalyticsClient({
17
+ token: coveoAnalyticsToken,
18
+ endpoint: `https://${coveoOrganizationId}.analytics.org.coveo.com`
19
+ });
20
+ const pathParts = window.location.pathname.split("/");
21
+ let contentType;
22
+ if (pathParts.length >= 2) {
23
+ contentType = pathParts[1];
24
+ }
25
+
26
+ ua.sendViewEvent({
27
+ contentIdKey: "@clickableuri",
28
+ contentType: contentType,
29
+ contentIdValue: window.location.href
30
+ });
31
+ }
32
+ }