@salesforcedevs/docs-components 1.3.150-alpha → 1.3.150-alpha3

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-alpha3",
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,21 @@ export default class AmfReference extends LightningElement {
215
217
  }
216
218
  }
217
219
 
220
+ private logCoveoPageView() {
221
+ console.log("log coveo page view");
222
+
223
+ if (this.coveoOrganizationId) {
224
+ const ua = new CoveoAnalyticsClient({
225
+ token: this.coveoPageViewToken,
226
+ endpoint: `https://${"fullsalesforce"}.analytics.org.coveo.com`
227
+ });
228
+ ua.sendViewEvent({
229
+ contentIdKey: "@clickableuri",
230
+ contentIdValue: window.location.href
231
+ });
232
+ }
233
+ }
234
+
218
235
  /**
219
236
  * Check if the URL hash to see whether this is one we want to redirect
220
237
  * See GUS W-10718771 for references where we want hash-based redirects
@@ -907,6 +924,8 @@ export default class AmfReference extends LightningElement {
907
924
  this.handleSelectedItem();
908
925
 
909
926
  this.updateDocPhase();
927
+
928
+ this.logCoveoPageView();
910
929
  }
911
930
 
912
931
  /**
@@ -1168,6 +1187,8 @@ export default class AmfReference extends LightningElement {
1168
1187
  if (referenceItem) {
1169
1188
  window.location.href = referenceItem.href;
1170
1189
  }
1190
+
1191
+ this.logCoveoPageView();
1171
1192
  }
1172
1193
 
1173
1194
  /**
@@ -1242,18 +1263,14 @@ export default class AmfReference extends LightningElement {
1242
1263
  }
1243
1264
  if (!isRedirecting) {
1244
1265
  const currentReferenceUrl = window.location.href;
1245
- console.log("currentReferenceUrl", currentReferenceUrl);
1246
1266
  const referenceMeta =
1247
1267
  this.getMarkdownReferenceMeta(currentReferenceUrl);
1248
- console.log("referenceMeta", referenceMeta);
1249
1268
  const selectedItemRefId =
1250
1269
  this.getReferenceIdFromUrl(currentReferenceUrl);
1251
- console.log("selectedItemRefId", selectedItemRefId);
1252
1270
  const referenceDetails = this.getRefDetailsForGivenTopicMeta(
1253
1271
  selectedItemRefId,
1254
1272
  referenceMeta
1255
1273
  );
1256
- console.log("referenceDtails", referenceDetails);
1257
1274
  if (referenceDetails) {
1258
1275
  this.updateNavTitleMetaTag(referenceDetails.topicTitle);
1259
1276
  }
@@ -1264,6 +1281,8 @@ export default class AmfReference extends LightningElement {
1264
1281
  }
1265
1282
  this.updateDocPhase();
1266
1283
  this.selectedSidebarValue = window.location.pathname;
1284
+
1285
+ this.logCoveoPageView();
1267
1286
  }
1268
1287
  }
1269
1288
 
@@ -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;