@salesforcedevs/docs-components 1.3.149-query-string-1 → 1.3.150-alpha2

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.149-query-string-1",
3
+ "version": "1.3.150-alpha2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -4,6 +4,7 @@ import { sentenceCase } from "sentence-case";
4
4
  import qs from "query-string";
5
5
  import { AmfModelParser } from "./utils";
6
6
  import { normalizeBoolean } from "dxUtils/normalizers";
7
+ import { CoveoAnalyticsClient } from "coveo.analytics";
7
8
  import type {
8
9
  AmfConfig,
9
10
  AmfMetadataTopic,
@@ -34,6 +35,7 @@ export default class AmfReference extends LightningElement {
34
35
  @api sidebarHeader!: string;
35
36
  @api coveoOrganizationId!: string;
36
37
  @api coveoPublicAccessToken!: string;
38
+ @api coveoPageViewToken!: string;
37
39
  @api coveoAdvancedQueryConfig!: string;
38
40
  @api coveoSearchHub!: string;
39
41
  @api useOldSidebar?: boolean = false;
@@ -215,6 +217,19 @@ export default class AmfReference extends LightningElement {
215
217
  }
216
218
  }
217
219
 
220
+ private logCoveoPageView() {
221
+ console.log("log coveo page view");
222
+
223
+ const ua = new CoveoAnalyticsClient({
224
+ token: this.coveoPageViewToken,
225
+ endpoint: `https://${"fullsalesforce"}.analytics.org.coveo.com`
226
+ });
227
+ ua.sendViewEvent({
228
+ contentIdKey: "@clickableuri",
229
+ contentIdValue: window.location.href
230
+ });
231
+ }
232
+
218
233
  /**
219
234
  * Check if the URL hash to see whether this is one we want to redirect
220
235
  * See GUS W-10718771 for references where we want hash-based redirects
@@ -907,6 +922,8 @@ export default class AmfReference extends LightningElement {
907
922
  this.handleSelectedItem();
908
923
 
909
924
  this.updateDocPhase();
925
+
926
+ this.logCoveoPageView();
910
927
  }
911
928
 
912
929
  /**
@@ -1168,6 +1185,8 @@ export default class AmfReference extends LightningElement {
1168
1185
  if (referenceItem) {
1169
1186
  window.location.href = referenceItem.href;
1170
1187
  }
1188
+
1189
+ this.logCoveoPageView();
1171
1190
  }
1172
1191
 
1173
1192
  /**
@@ -1260,6 +1279,8 @@ export default class AmfReference extends LightningElement {
1260
1279
  }
1261
1280
  this.updateDocPhase();
1262
1281
  this.selectedSidebarValue = window.location.pathname;
1282
+
1283
+ this.logCoveoPageView();
1263
1284
  }
1264
1285
  }
1265
1286
 
@@ -17,6 +17,7 @@ import { LightningElementWithState } from "docBaseElements/lightningElementWithS
17
17
  import { oldVersionDocInfo } from "docUtils/utils";
18
18
  import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
19
19
  import { track as trackGTM } from "dxUtils/analytics";
20
+ import { CoveoAnalyticsClient } from "coveo.analytics";
20
21
 
21
22
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
22
23
  const handleContentError = (error): void => console.log(error);
@@ -34,6 +35,7 @@ export default class DocXmlContent extends LightningElementWithState<{
34
35
  @api apiDomain = "https://developer.salesforce.com";
35
36
  @api coveoOrganizationId!: string;
36
37
  @api coveoPublicAccessToken!: string;
38
+ @api coveoPageViewToken!: string;
37
39
  @api coveoSearchHub!: string;
38
40
 
39
41
  @api
@@ -450,6 +452,18 @@ export default class DocXmlContent extends LightningElementWithState<{
450
452
  return;
451
453
  }
452
454
 
455
+ console.log("log coveo page view");
456
+ if (this.coveoOrganizationId) {
457
+ const ua = new CoveoAnalyticsClient({
458
+ token: this.coveoPageViewToken,
459
+ endpoint: `https://${this.coveoOrganizationId}.analytics.org.coveo.com`
460
+ }); // MILES TODO: replace 'fullsalesforce' with coveo organizationid
461
+ ua.sendViewEvent({
462
+ contentIdKey: "@clickableuri",
463
+ contentIdValue: window.location.href
464
+ });
465
+ }
466
+
453
467
  this.docTitle = data.docTitle;
454
468
  this.tocMap = data.tocMap;
455
469
  this.sidebarContent = data.toc;