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

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-alpha1",
3
+ "version": "1.3.138-coveo-alpha2",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -6,6 +6,7 @@
6
6
  coveo-public-access-token={coveoPublicAccessToken}
7
7
  coveo-search-hub={coveoSearchHub}
8
8
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
9
+ version={versionForCoveo}
9
10
  breadcrumbs={breadcrumbs}
10
11
  sidebar-header={sidebarHeader}
11
12
  sidebar-value={selectedSidebarValue}
@@ -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, toJson } from "dxUtils/normalizers";
6
+ import { normalizeBoolean } from "dxUtils/normalizers";
7
7
  import type {
8
8
  AmfConfig,
9
9
  AmfMetadataTopic,
@@ -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;
@@ -111,6 +111,7 @@ export default class AmfReference extends LightningElement {
111
111
  ) {
112
112
  this.showVersionBanner = true;
113
113
  }
114
+ this.setReferenceVersionForCoveo();
114
115
  }
115
116
 
116
117
  // This is to check if the url is hash based and redirect if needed
@@ -122,6 +123,19 @@ export default class AmfReference extends LightningElement {
122
123
  }
123
124
  }
124
125
 
126
+ private setReferenceVersionForCoveo(): void {
127
+ let version = "latest";
128
+ const allVersions = this.getVersions();
129
+ if (allVersions.length > 1 && this.selectedVersion) {
130
+ const currentGAVersionRef = allVersions[0];
131
+ if (this.selectedVersion.id !== currentGAVersionRef.id) {
132
+ version = this.selectedVersion.id;
133
+ }
134
+ }
135
+ console.log("AMFReferences: " + version);
136
+ this.versionForCoveo = version;
137
+ }
138
+
125
139
  @api
126
140
  get docPhaseInfo() {
127
141
  return this.selectedReferenceDocPhase;
@@ -143,25 +157,6 @@ export default class AmfReference extends LightningElement {
143
157
  this._expandChildren = normalizeBoolean(value);
144
158
  }
145
159
 
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
-
165
160
  // model
166
161
  protected _amfConfigList: AmfConfig[] = [];
167
162
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
@@ -176,6 +171,7 @@ export default class AmfReference extends LightningElement {
176
171
  protected selectedSidebarValue = undefined;
177
172
 
178
173
  protected selectedVersion: ReferenceVersion | null = null;
174
+ protected versionForCoveo: string = "latest";
179
175
 
180
176
  private hasRendered = false;
181
177
 
@@ -183,8 +179,6 @@ export default class AmfReference extends LightningElement {
183
179
  private selectedReferenceDocPhase?: string | null = null;
184
180
  private _expandChildren?: boolean = false;
185
181
 
186
- protected _coveoAdvancedQueryConfig!: CoveoAdvancedQueryXMLConfig;
187
-
188
182
  /**
189
183
  * Key for storing the currently selected reference url. This will be used to save the
190
184
  * previously selected reference url and restoring it when changing between reference versions.
@@ -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;
@@ -33,8 +33,19 @@ export default class ContentLayout extends LightningElement {
33
33
  @api coveoOrganizationId!: string;
34
34
  @api coveoPublicAccessToken!: string;
35
35
  @api coveoSearchHub!: string;
36
- @api coveoAdvancedQueryConfig!: string;
36
+
37
37
  @api useOldSidebar?: boolean = false;
38
+ @api
39
+ get version(): string {
40
+ return this._newVersion;
41
+ }
42
+
43
+ set version(val) {
44
+ if (val) {
45
+ this._newVersion = val;
46
+ }
47
+ console.log("Content Layout: " + this._newVersion);
48
+ }
38
49
 
39
50
  @api
40
51
  get breadcrumbs() {
@@ -70,13 +81,32 @@ export default class ContentLayout extends LightningElement {
70
81
  this.template.querySelector("dx-sidebar")?.setInputValue(searchTerm);
71
82
  }
72
83
 
84
+ @api
85
+ set coveoAdvancedQueryConfig(config) {
86
+ const coveoConfig = toJson(config);
87
+ if (this._newVersion !== "latest") {
88
+ coveoConfig.version = this._newVersion;
89
+ }
90
+ this._coveoAdvancedQueryConfig = coveoConfig;
91
+ }
92
+
93
+ get coveoAdvancedQueryConfig() {
94
+ console.log(
95
+ "AQ Content Layout: " +
96
+ JSON.stringify(this._coveoAdvancedQueryConfig)
97
+ );
98
+ return this._coveoAdvancedQueryConfig;
99
+ }
100
+
73
101
  @track
74
102
  private _sidebarContent: unknown;
75
103
 
76
104
  private _breadcrumbs = null;
105
+ protected _newVersion: string = "latest";
77
106
 
78
107
  @track
79
108
  private _tocOptions: Array<unknown>;
109
+ private _coveoAdvancedQueryConfig!: string;
80
110
 
81
111
  private tocOptionIdsSet = new Set();
82
112
  private anchoredElements: AnchorMap = {};