@salesforcedevs/docs-components 1.3.131 → 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.131",
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",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "b685c8d1d050c0fa402922a7435c43ec37a91a0c"
27
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
28
  }
@@ -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 {
@@ -34,7 +35,6 @@ export default class AmfReference extends LightningElement {
34
35
  @api sidebarHeader!: string;
35
36
  @api coveoOrganizationId!: string;
36
37
  @api coveoPublicAccessToken!: string;
37
- @api coveoAdvancedQueryConfig!: string;
38
38
  @api coveoSearchHub!: string;
39
39
  @api useOldSidebar?: boolean = false;
40
40
  @api tocTitle?: string;
@@ -143,6 +143,25 @@ export default class AmfReference extends LightningElement {
143
143
  this._expandChildren = normalizeBoolean(value);
144
144
  }
145
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
+
146
165
  // model
147
166
  protected _amfConfigList: AmfConfig[] = [];
148
167
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
@@ -164,6 +183,8 @@ export default class AmfReference extends LightningElement {
164
183
  private selectedReferenceDocPhase?: string | null = null;
165
184
  private _expandChildren?: boolean = false;
166
185
 
186
+ protected _coveoAdvancedQueryConfig!: CoveoAdvancedQueryXMLConfig;
187
+
167
188
  /**
168
189
  * Key for storing the currently selected reference url. This will be used to save the
169
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"
@@ -214,13 +214,16 @@ export default class ContentLayout extends LightningElement {
214
214
 
215
215
  // sync with the browser to account for any reflows that may have happened
216
216
  requestAnimationFrame(() => {
217
+ // ternary is a temporary fix for the global nav height reporting incorrectly on some browsers
217
218
  const globalNavHeight =
218
- globalNavEl.offsetHeight + contextNavEl.offsetHeight;
219
- const docHeaderHeight = docHeaderEl.offsetHeight;
219
+ (globalNavEl.getBoundingClientRect().height !== 72 ? 0 : 72) +
220
+ contextNavEl.getBoundingClientRect().height;
221
+ const docHeaderHeight = docHeaderEl.getBoundingClientRect().height;
220
222
  sidebarEl.style.setProperty(
221
223
  "--dx-c-content-sidebar-sticky-top",
222
224
  `${globalNavHeight + docHeaderHeight}px`
223
225
  );
226
+
224
227
  docHeaderEl.style.setProperty(
225
228
  "--dx-g-global-header-height",
226
229
  `${globalNavHeight}px`
@@ -234,7 +237,7 @@ export default class ContentLayout extends LightningElement {
234
237
  window.innerWidth < 769
235
238
  ? globalNavHeight +
236
239
  docHeaderHeight +
237
- sidebarEl.offsetHeight
240
+ sidebarEl.getBoundingClientRect().height
238
241
  : globalNavHeight + docHeaderHeight
239
242
  }px`
240
243
  );
@@ -247,7 +250,7 @@ export default class ContentLayout extends LightningElement {
247
250
  docHeadingEl.style.scrollMarginTop = `${
248
251
  globalNavHeight +
249
252
  docHeaderHeight +
250
- docPhaseEl.offsetHeight
253
+ docPhaseEl.getBoundingClientRect().height
251
254
  }px`;
252
255
  });
253
256
 
@@ -259,7 +262,7 @@ export default class ContentLayout extends LightningElement {
259
262
  rightNavBarEl.style.top = `${
260
263
  globalNavHeight +
261
264
  docHeaderHeight +
262
- docPhaseEl.offsetHeight
265
+ docPhaseEl.getBoundingClientRect().height
263
266
  }px`;
264
267
  }
265
268
  }
@@ -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
  };
package/LICENSE DELETED
@@ -1,12 +0,0 @@
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.