@salesforcedevs/docs-components 1.3.173 → 1.3.177

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.173",
3
+ "version": "1.3.177",
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": "85f6ef2fd7789804c470b862101492739432cc04"
27
+ "gitHead": "fd34f6d2447461ef0dd93045c8df04cf090b97f2"
28
28
  }
@@ -4,6 +4,7 @@
4
4
  class="content-type content-type-reference"
5
5
  coveo-organization-id={coveoOrganizationId}
6
6
  coveo-public-access-token={coveoPublicAccessToken}
7
+ coveo-analytics-token={coveoAnalyticsToken}
7
8
  coveo-search-hub={coveoSearchHub}
8
9
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
9
10
  breadcrumbs={breadcrumbs}
@@ -4,7 +4,6 @@ import { sentenceCase } from "sentence-case";
4
4
  import qs from "query-string";
5
5
  import { AmfModelParser } from "doc/amfModelParser";
6
6
  import { normalizeBoolean } from "dxUtils/normalizers";
7
- import { CoveoAnalyticsClient } from "coveo.analytics";
8
7
  import type {
9
8
  AmfConfig,
10
9
  AmfMetadataTopic,
@@ -225,19 +224,6 @@ export default class AmfReference extends LightningElement {
225
224
  }
226
225
  }
227
226
 
228
- private logCoveoPageView() {
229
- if (this.coveoOrganizationId && this.coveoAnalyticsToken) {
230
- const ua = new CoveoAnalyticsClient({
231
- token: this.coveoAnalyticsToken,
232
- endpoint: `https://${this.coveoOrganizationId}.analytics.org.coveo.com`
233
- });
234
- ua.sendViewEvent({
235
- contentIdKey: "@clickableuri",
236
- contentIdValue: window.location.href
237
- });
238
- }
239
- }
240
-
241
227
  /**
242
228
  * Check if the URL hash to see whether this is one we want to redirect
243
229
  * See GUS W-10718771 for references where we want hash-based redirects
@@ -941,8 +927,6 @@ export default class AmfReference extends LightningElement {
941
927
  this.handleSelectedItem();
942
928
 
943
929
  this.updateDocPhase();
944
-
945
- this.logCoveoPageView();
946
930
  }
947
931
 
948
932
  /**
@@ -1204,8 +1188,6 @@ export default class AmfReference extends LightningElement {
1204
1188
  if (referenceItem) {
1205
1189
  window.location.href = referenceItem.href;
1206
1190
  }
1207
-
1208
- this.logCoveoPageView();
1209
1191
  }
1210
1192
 
1211
1193
  /**
@@ -1298,8 +1280,6 @@ export default class AmfReference extends LightningElement {
1298
1280
  }
1299
1281
  this.updateDocPhase();
1300
1282
  this.selectedSidebarValue = window.location.pathname;
1301
-
1302
- this.logCoveoPageView();
1303
1283
  }
1304
1284
  }
1305
1285
 
@@ -4,6 +4,7 @@ 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";
7
8
 
8
9
  type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
9
10
 
@@ -32,9 +33,11 @@ export default class ContentLayout extends LightningElement {
32
33
  @api enableSlotChange = false;
33
34
  @api coveoOrganizationId!: string;
34
35
  @api coveoPublicAccessToken!: string;
36
+ @api coveoAnalyticsToken!: string;
35
37
  @api coveoSearchHub!: string;
36
38
  @api coveoAdvancedQueryConfig!: string;
37
39
  @api useOldSidebar?: boolean = false;
40
+ @api logCoveoPageViewOnlyOnConnect: boolean = false;
38
41
 
39
42
  @api
40
43
  get breadcrumbs() {
@@ -127,6 +130,19 @@ export default class ContentLayout extends LightningElement {
127
130
  );
128
131
  }
129
132
 
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
+
130
146
  connectedCallback(): void {
131
147
  const hasParentHighlightListener = closest(
132
148
  "doc-xml-content",
@@ -139,6 +155,9 @@ export default class ContentLayout extends LightningElement {
139
155
  );
140
156
  this.searchSyncer.init();
141
157
  }
158
+ if (this.logCoveoPageViewOnlyOnConnect) {
159
+ this.logCoveoPageView();
160
+ }
142
161
  }
143
162
 
144
163
  renderedCallback(): void {
@@ -159,6 +178,8 @@ export default class ContentLayout extends LightningElement {
159
178
  if (!this.hasRendered) {
160
179
  this.hasRendered = true;
161
180
  this.restoreScroll();
181
+ } else if (!this.logCoveoPageViewOnlyOnConnect) {
182
+ this.logCoveoPageView();
162
183
  }
163
184
  }
164
185
 
@@ -3,6 +3,7 @@
3
3
  if:true={loaded}
4
4
  coveo-organization-id={coveoOrganizationId}
5
5
  coveo-public-access-token={coveoPublicAccessToken}
6
+ coveo-analytics-token={coveoAnalyticsToken}
6
7
  coveo-search-hub={coveoSearchHub}
7
8
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
8
9
  sidebar-header="Pages"
@@ -16,7 +16,6 @@ import { LightningElementWithState } from "docBaseElements/lightningElementWithS
16
16
  import { oldVersionDocInfo } from "docUtils/utils";
17
17
  import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
18
18
  import { track as trackGTM } from "dxUtils/analytics";
19
- import { CoveoAnalyticsClient } from "coveo.analytics";
20
19
  import { SearchSyncer } from "docUtils/searchSyncer";
21
20
 
22
21
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
@@ -438,19 +437,6 @@ export default class DocXmlContent extends LightningElementWithState<{
438
437
  );
439
438
  }
440
439
 
441
- async logCoveoPageView() {
442
- if (this.coveoOrganizationId && this.coveoAnalyticsToken) {
443
- const ua = new CoveoAnalyticsClient({
444
- token: this.coveoAnalyticsToken,
445
- endpoint: `https://${this.coveoOrganizationId}.analytics.org.coveo.com`
446
- }); // MILES TODO: replace 'fullsalesforce' with coveo organizationid
447
- ua.sendViewEvent({
448
- contentIdKey: "@clickableuri",
449
- contentIdValue: window.location.href
450
- });
451
- }
452
- }
453
-
454
440
  async fetchDocument(): Promise<void> {
455
441
  this.setState({
456
442
  isFetchingDocument: true
@@ -515,7 +501,6 @@ export default class DocXmlContent extends LightningElementWithState<{
515
501
  }
516
502
 
517
503
  async fetchContent(): Promise<void> {
518
- this.logCoveoPageView();
519
504
  this.setState({
520
505
  isFetchingContent: true
521
506
  });