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

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.139-coveo-fix-test4",
3
+ "version": "1.3.139-coveo-fix-test6",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -14,6 +14,7 @@
14
14
  onexpandcollapse={onExpandCollapse}
15
15
  toc-title={tocTitle}
16
16
  toc-options={tocOptions}
17
+ selected-version={curSelectedVersion}
17
18
  enable-slot-change="true"
18
19
  >
19
20
  <doc-phase
@@ -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,7 @@ 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;
113
+ this.setCurrentSelectedVersion();
116
114
  }
117
115
  }
118
116
 
@@ -125,31 +123,6 @@ export default class AmfReference extends LightningElement {
125
123
  }
126
124
  }
127
125
 
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
126
  @api
154
127
  get docPhaseInfo() {
155
128
  return this.selectedReferenceDocPhase;
@@ -176,7 +149,6 @@ export default class AmfReference extends LightningElement {
176
149
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
177
150
  protected _referenceSetConfig!: ReferenceSetConfig;
178
151
  protected _currentReferenceId = "";
179
- protected _coveoAdvancedQueryConfig!: CoveoAdvancedQueryXMLConfig;
180
152
 
181
153
  protected parentReferenceUrls = [];
182
154
  protected amfMap: Record<string, AmfModelRecord> = {};
@@ -184,6 +156,7 @@ export default class AmfReference extends LightningElement {
184
156
  protected metadata: { [key: string]: AmfMetadataTopic } = {};
185
157
  protected selectedTopic?: AmfMetaTopicType = undefined;
186
158
  protected selectedSidebarValue = undefined;
159
+ protected curSelectedVersion = "latest";
187
160
 
188
161
  protected selectedVersion: ReferenceVersion | null = null;
189
162
 
@@ -370,6 +343,12 @@ export default class AmfReference extends LightningElement {
370
343
  return selectedVersion || (versions.length && versions[0]);
371
344
  }
372
345
 
346
+ private setCurrentSelectedVersion() {
347
+ if (this.showVersionBanner) {
348
+ this.curSelectedVersion = this.getSelectedVersion().id;
349
+ }
350
+ }
351
+
373
352
  private updateAmfConfigInView(): void {
374
353
  if (this._amfConfigList && this._amfConfigList.length) {
375
354
  // fetch AMF Json as soon as config is set
@@ -1286,9 +1265,7 @@ export default class AmfReference extends LightningElement {
1286
1265
  this.versions = this.getVersions();
1287
1266
  if (this.oldVersionInfo) {
1288
1267
  this.showVersionBanner = true;
1289
- const newCoveoQueryConfig = this._coveoAdvancedQueryConfig;
1290
- newCoveoQueryConfig.version = this.getSelectedVersion().id;
1291
- this._coveoAdvancedQueryConfig = newCoveoQueryConfig;
1268
+ this.setCurrentSelectedVersion();
1292
1269
  }
1293
1270
  this.updateDocPhase();
1294
1271
  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;
@@ -22,6 +22,7 @@
22
22
  coveo-search-hub={coveoSearchHub}
23
23
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
24
24
  ontogglesidebar={onToggleSidebar}
25
+ selected-version={selectedVersion}
25
26
  >
26
27
  <slot name="sidebar-header" slot="header"></slot>
27
28
  </dx-sidebar>
@@ -35,6 +35,7 @@ export default class ContentLayout extends LightningElement {
35
35
  @api coveoSearchHub!: string;
36
36
  @api coveoAdvancedQueryConfig!: string;
37
37
  @api useOldSidebar?: boolean = false;
38
+ @api selectedVersion?: string;
38
39
 
39
40
  @api
40
41
  get breadcrumbs() {