@salesforcedevs/docs-components 1.3.138-coveo-alpha → 1.3.138-coveo-alpha1

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.138-coveo-alpha",
3
+ "version": "1.3.138-coveo-alpha1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -3,7 +3,7 @@ import { noCase } from "no-case";
3
3
  import { sentenceCase } from "sentence-case";
4
4
  import qs from "query-string";
5
5
  import { AmfModelParser } from "./utils";
6
- import { normalizeBoolean } from "dxUtils/normalizers";
6
+ import { normalizeBoolean, toJson } from "dxUtils/normalizers";
7
7
  import type {
8
8
  AmfConfig,
9
9
  AmfMetadataTopic,
@@ -16,7 +16,8 @@ import type {
16
16
  ReferenceSetConfig,
17
17
  AmfMetaTopicType,
18
18
  RouteMeta,
19
- ParsedMarkdownTopic
19
+ ParsedMarkdownTopic,
20
+ CoveoAdvancedQueryXMLConfig
20
21
  } from "./types";
21
22
 
22
23
  import {
@@ -121,21 +122,6 @@ export default class AmfReference extends LightningElement {
121
122
  }
122
123
  }
123
124
 
124
- private get coveoAdvancedQueryConfig(config: string): string {
125
- try {
126
- const coveoAgConfig = JSON.parse(config);
127
- if(this.showVersionBanner) {
128
- coveoAgConfig.version = this.getSelectedVersion();
129
- } else {
130
- coveoAgConfig.version = "latest";
131
- }
132
-
133
- return JSON.stringify(coveoAgConfig);
134
- } catch (error) {
135
- console.log(`Error during version implementation.`)
136
- }
137
- }
138
-
139
125
  @api
140
126
  get docPhaseInfo() {
141
127
  return this.selectedReferenceDocPhase;
@@ -157,6 +143,25 @@ export default class AmfReference extends LightningElement {
157
143
  this._expandChildren = normalizeBoolean(value);
158
144
  }
159
145
 
146
+ @api
147
+ set coveoAdvancedQueryConfig(config) {
148
+ const coveoConfig = toJson(config);
149
+ if (this.versions.length > 1 && this.selectedVersion) {
150
+ const currentGAVersionRef = this.versions[0];
151
+ if (this.selectedVersion.id !== currentGAVersionRef.id) {
152
+ coveoConfig.version = this.selectedVersion.id;
153
+ }
154
+ }
155
+ this._coveoAdvancedQueryConfig = coveoConfig;
156
+ }
157
+
158
+ get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
159
+ console.log(
160
+ "AMFReference: " + JSON.stringify(this._coveoAdvancedQueryConfig)
161
+ );
162
+ return this._coveoAdvancedQueryConfig;
163
+ }
164
+
160
165
  // model
161
166
  protected _amfConfigList: AmfConfig[] = [];
162
167
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
@@ -178,6 +183,8 @@ export default class AmfReference extends LightningElement {
178
183
  private selectedReferenceDocPhase?: string | null = null;
179
184
  private _expandChildren?: boolean = false;
180
185
 
186
+ protected _coveoAdvancedQueryConfig!: CoveoAdvancedQueryXMLConfig;
187
+
181
188
  /**
182
189
  * Key for storing the currently selected reference url. This will be used to save the
183
190
  * previously selected reference url and restoring it when changing between reference versions.
@@ -8,6 +8,12 @@ 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
+
11
17
  export interface AmfMetadataTopic extends AmfTopicType {
12
18
  meta: string;
13
19
  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"
@@ -40,8 +40,8 @@ header:not(.has-brand) > .header_l2 {
40
40
  }
41
41
 
42
42
  .header_lang-dropdown {
43
- --button-primary-color: var(--dx-g-blue-vibrant-50);
44
- --button-primary-color-hover: var(--dx-g-blue-vibrant-40);
43
+ --button-primary-color: var(--dx-g-blue-vibrant-40);
44
+ --button-primary-color-hover: var(--dx-g-blue-vibrant-30);
45
45
  }
46
46
 
47
47
  .header_lang-dropdown > dx-button {
@@ -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
  };