@salesforcedevs/docs-components 1.3.150-alpha → 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.150-alpha",
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
  /**
@@ -1242,18 +1261,14 @@ export default class AmfReference extends LightningElement {
1242
1261
  }
1243
1262
  if (!isRedirecting) {
1244
1263
  const currentReferenceUrl = window.location.href;
1245
- console.log("currentReferenceUrl", currentReferenceUrl);
1246
1264
  const referenceMeta =
1247
1265
  this.getMarkdownReferenceMeta(currentReferenceUrl);
1248
- console.log("referenceMeta", referenceMeta);
1249
1266
  const selectedItemRefId =
1250
1267
  this.getReferenceIdFromUrl(currentReferenceUrl);
1251
- console.log("selectedItemRefId", selectedItemRefId);
1252
1268
  const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1253
1269
  selectedItemRefId,
1254
1270
  referenceMeta
1255
1271
  );
1256
- console.log("referenceDtails", referenceDetails);
1257
1272
  if (referenceDetails) {
1258
1273
  this.updateNavTitleMetaTag(referenceDetails.topicTitle);
1259
1274
  }
@@ -1264,6 +1279,8 @@ export default class AmfReference extends LightningElement {
1264
1279
  }
1265
1280
  this.updateDocPhase();
1266
1281
  this.selectedSidebarValue = window.location.pathname;
1282
+
1283
+ this.logCoveoPageView();
1267
1284
  }
1268
1285
  }
1269
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;