@salesforcedevs/docs-components 1.3.139-coveo-fix-test4 → 1.3.147

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/LICENSE ADDED
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2020, Salesforce.com, Inc.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.139-coveo-fix-test4",
3
+ "version": "1.3.147",
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": "4629fdd9ca18a13480044ad43515b91945d16aad"
27
+ "gitHead": "c046874452685c28208a52392b494ad791c3f305"
28
28
  }
@@ -16,8 +16,7 @@ import type {
16
16
  ReferenceSetConfig,
17
17
  AmfMetaTopicType,
18
18
  RouteMeta,
19
- ParsedMarkdownTopic,
20
- CoveoAdvancedQueryXMLConfig
19
+ ParsedMarkdownTopic
21
20
  } from "./types";
22
21
 
23
22
  import {
@@ -35,6 +34,7 @@ export default class AmfReference extends LightningElement {
35
34
  @api sidebarHeader!: string;
36
35
  @api coveoOrganizationId!: string;
37
36
  @api coveoPublicAccessToken!: string;
37
+ @api coveoAdvancedQueryConfig!: string;
38
38
  @api coveoSearchHub!: string;
39
39
  @api useOldSidebar?: boolean = false;
40
40
  @api tocTitle?: string;
@@ -110,9 +110,6 @@ export default class AmfReference extends LightningElement {
110
110
  this.oldVersionInfo
111
111
  ) {
112
112
  this.showVersionBanner = true;
113
- const newCoveoQueryConfig = this._coveoAdvancedQueryConfig;
114
- newCoveoQueryConfig.version = selectedVersion.id;
115
- this._coveoAdvancedQueryConfig = newCoveoQueryConfig;
116
113
  }
117
114
  }
118
115
 
@@ -125,31 +122,6 @@ export default class AmfReference extends LightningElement {
125
122
  }
126
123
  }
127
124
 
128
- @api
129
- set coveoAdvancedQueryConfig(config: CoveoAdvancedQueryXMLConfig) {
130
- try {
131
- const coveoConfig =
132
- typeof config === "string" ? JSON.parse(config) : config;
133
- this._coveoAdvancedQueryConfig = coveoConfig;
134
- } catch (e) {
135
- this._coveoAdvancedQueryConfig = {
136
- locale: "en-us",
137
- version: "latest",
138
- topicid: this._currentReferenceId
139
- };
140
- }
141
- console.log(
142
- "Setting AQ: " + JSON.stringify(this._coveoAdvancedQueryConfig)
143
- );
144
- }
145
-
146
- private get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
147
- console.log(
148
- "Getting AQ: " + JSON.stringify(this._coveoAdvancedQueryConfig)
149
- );
150
- return this._coveoAdvancedQueryConfig;
151
- }
152
-
153
125
  @api
154
126
  get docPhaseInfo() {
155
127
  return this.selectedReferenceDocPhase;
@@ -176,7 +148,6 @@ export default class AmfReference extends LightningElement {
176
148
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
177
149
  protected _referenceSetConfig!: ReferenceSetConfig;
178
150
  protected _currentReferenceId = "";
179
- protected _coveoAdvancedQueryConfig!: CoveoAdvancedQueryXMLConfig;
180
151
 
181
152
  protected parentReferenceUrls = [];
182
153
  protected amfMap: Record<string, AmfModelRecord> = {};
@@ -1286,9 +1257,6 @@ export default class AmfReference extends LightningElement {
1286
1257
  this.versions = this.getVersions();
1287
1258
  if (this.oldVersionInfo) {
1288
1259
  this.showVersionBanner = true;
1289
- const newCoveoQueryConfig = this._coveoAdvancedQueryConfig;
1290
- newCoveoQueryConfig.version = this.getSelectedVersion().id;
1291
- this._coveoAdvancedQueryConfig = newCoveoQueryConfig;
1292
1260
  }
1293
1261
  this.updateDocPhase();
1294
1262
  this.selectedSidebarValue = window.location.pathname;
@@ -8,12 +8,6 @@ export interface AmfTopicType {
8
8
  type: string;
9
9
  }
10
10
 
11
- export type CoveoAdvancedQueryXMLConfig = {
12
- locale?: string;
13
- version?: string;
14
- topicid?: string;
15
- };
16
-
17
11
  export interface AmfMetadataTopic extends AmfTopicType {
18
12
  meta: string;
19
13
  identifier: string;
@@ -53,7 +53,7 @@ export default class BreadcrumbItem extends LightningElement {
53
53
  private onLinkClick(event: Event): void {
54
54
  track(event.target!, "custEv_breadcrumbClick", {
55
55
  click_text: this.label,
56
- click_url: this.href,
56
+ click_url: `${window.location.origin}${this.href}`,
57
57
  element_type: "link",
58
58
  nav_type: "breadcrumb",
59
59
  nav_level: this.level ? this.level + 1 : 1,
@@ -62,7 +62,7 @@ export default class BreadcrumbItem extends LightningElement {
62
62
 
63
63
  track(event.target!, "custEv_linkClick", {
64
64
  click_text: this.label,
65
- click_url: this.href,
65
+ click_url: `${window.location.origin}${this.href}`,
66
66
  element_title: this.label,
67
67
  element_type: "link",
68
68
  content_category: "cta"
@@ -133,6 +133,7 @@ export default class Header extends HeaderBase {
133
133
  private onLangChange(event: CustomEvent<string>): void {
134
134
  const { detail } = event;
135
135
  this._language = detail;
136
+
136
137
  this.dispatchEvent(new CustomEvent("langchange", { detail }));
137
138
  }
138
139
 
@@ -16,6 +16,7 @@ import { SearchSyncer } from "docUtils/SearchSyncer";
16
16
  import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
17
17
  import { oldVersionDocInfo } from "docUtils/utils";
18
18
  import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
19
+ import { track as trackGTM } from "dxUtils/analytics";
19
20
 
20
21
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
21
22
  const handleContentError = (error): void => console.log(error);
@@ -364,6 +365,17 @@ export default class DocXmlContent extends LightningElementWithState<{
364
365
  ({ id }) => id === event.detail
365
366
  );
366
367
  this.pageReference.docId = this.language.url;
368
+
369
+ trackGTM(event.target!, "custEv_ctaLinkClick", {
370
+ click_text: event.detail,
371
+ element_title: "language selector",
372
+ click_url: `${window.location.origin}${this.pageReferenceToString(
373
+ this.pageReference
374
+ )}`,
375
+ element_type: "link",
376
+ content_category: "cta"
377
+ });
378
+
367
379
  this.updateUrl();
368
380
  this.fetchDocument();
369
381
  };