@salesforcedevs/docs-components 1.3.138-coveo-alpha3 → 1.3.138-coveo-fix1

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-alpha3",
3
+ "version": "1.3.138-coveo-fix1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <doc-content-layout
3
+ if:true={loaded}
3
4
  use-old-sidebar={useOldSidebar}
4
5
  class="content-type content-type-reference"
5
6
  coveo-organization-id={coveoOrganizationId}
6
7
  coveo-public-access-token={coveoPublicAccessToken}
7
8
  coveo-search-hub={coveoSearchHub}
8
- version={versionForCoveo}
9
9
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
10
10
  breadcrumbs={breadcrumbs}
11
11
  sidebar-header={sidebarHeader}
@@ -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,
@@ -34,7 +34,6 @@ export default class AmfReference extends LightningElement {
34
34
  @api sidebarHeader!: string;
35
35
  @api coveoOrganizationId!: string;
36
36
  @api coveoPublicAccessToken!: string;
37
- @api coveoAdvancedQueryConfig!: string;
38
37
  @api coveoSearchHub!: string;
39
38
  @api useOldSidebar?: boolean = false;
40
39
  @api tocTitle?: string;
@@ -111,7 +110,6 @@ export default class AmfReference extends LightningElement {
111
110
  ) {
112
111
  this.showVersionBanner = true;
113
112
  }
114
- this.setReferenceVersionForCoveo();
115
113
  }
116
114
 
117
115
  // This is to check if the url is hash based and redirect if needed
@@ -123,19 +121,6 @@ export default class AmfReference extends LightningElement {
123
121
  }
124
122
  }
125
123
 
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
-
139
124
  @api
140
125
  get docPhaseInfo() {
141
126
  return this.selectedReferenceDocPhase;
@@ -157,6 +142,25 @@ export default class AmfReference extends LightningElement {
157
142
  this._expandChildren = normalizeBoolean(value);
158
143
  }
159
144
 
145
+ @api
146
+ get coveoAdvancedQueryConfig(): { [key: string]: any } {
147
+ return this._coveoAdvancedQueryConfig;
148
+ }
149
+
150
+ set coveoAdvancedQueryConfig(config) {
151
+ const coveoConfig = toJson(config);
152
+ if (this.versions.length > 1 && this.selectedVersion) {
153
+ const currentGAVersionRef = this.versions[0];
154
+ if (this.selectedVersion.id !== currentGAVersionRef.id) {
155
+ coveoConfig.version = this.selectedVersion.id.replace("v", "");
156
+ }
157
+ }
158
+ this._coveoAdvancedQueryConfig = coveoConfig;
159
+ console.log(
160
+ "AQ AMF Ref: " + JSON.stringify(this._coveoAdvancedQueryConfig)
161
+ );
162
+ }
163
+
160
164
  // model
161
165
  protected _amfConfigList: AmfConfig[] = [];
162
166
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
@@ -171,13 +175,14 @@ export default class AmfReference extends LightningElement {
171
175
  protected selectedSidebarValue = undefined;
172
176
 
173
177
  protected selectedVersion: ReferenceVersion | null = null;
174
- protected versionForCoveo: string = "latest";
175
178
 
176
179
  private hasRendered = false;
177
180
 
178
181
  private isParentLevelDocPhaseEnabled = false;
179
182
  private selectedReferenceDocPhase?: string | null = null;
180
183
  private _expandChildren?: boolean = false;
184
+ private loaded = false;
185
+ private _coveoAdvancedQueryConfig!: { [key: string]: any };
181
186
 
182
187
  /**
183
188
  * Key for storing the currently selected reference url. This will be used to save the
@@ -198,6 +203,7 @@ export default class AmfReference extends LightningElement {
198
203
  }
199
204
 
200
205
  connectedCallback(): void {
206
+ this.loaded = true;
201
207
  this.addEventListener(
202
208
  "api-navigation-selection-changed",
203
209
  this._boundOnApiNavigationChanged
@@ -17,7 +17,7 @@
17
17
  trees={sidebarContent}
18
18
  value={sidebarValue}
19
19
  header={sidebarHeader}
20
- coveo-organization-id={getUpdateCoveoQuery}
20
+ coveo-organization-id={coveoOrganizationId}
21
21
  coveo-public-access-token={coveoPublicAccessToken}
22
22
  coveo-search-hub={coveoSearchHub}
23
23
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
@@ -33,19 +33,8 @@ export default class ContentLayout extends LightningElement {
33
33
  @api coveoOrganizationId!: string;
34
34
  @api coveoPublicAccessToken!: string;
35
35
  @api coveoSearchHub!: string;
36
-
36
+ @api coveoAdvancedQueryConfig!: string;
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
- }
49
38
 
50
39
  @api
51
40
  get breadcrumbs() {
@@ -81,24 +70,13 @@ export default class ContentLayout extends LightningElement {
81
70
  this.template.querySelector("dx-sidebar")?.setInputValue(searchTerm);
82
71
  }
83
72
 
84
- @api
85
- set coveoAdvancedQueryConfig(config) {
86
- this._coveoAdvancedQueryConfig = config;
87
- }
88
-
89
- get coveoAdvancedQueryConfig() {
90
- return this._coveoAdvancedQueryConfig;
91
- }
92
-
93
73
  @track
94
74
  private _sidebarContent: unknown;
95
75
 
96
76
  private _breadcrumbs = null;
97
- protected _newVersion: string = "latest";
98
77
 
99
78
  @track
100
79
  private _tocOptions: Array<unknown>;
101
- private _coveoAdvancedQueryConfig!: string;
102
80
 
103
81
  private tocOptionIdsSet = new Set();
104
82
  private anchoredElements: AnchorMap = {};
@@ -146,23 +124,6 @@ export default class ContentLayout extends LightningElement {
146
124
  );
147
125
  }
148
126
 
149
- private getUpdateCoveoQuery() {
150
- console.log(
151
- "Content-Layout Before: " +
152
- JSON.stringify(this._coveoAdvancedQueryConfig)
153
- );
154
- const coveoConfig = toJson(this._coveoAdvancedQueryConfig);
155
- if (this._newVersion !== "latest") {
156
- coveoConfig.version = this._newVersion;
157
- }
158
- this._coveoAdvancedQueryConfig = coveoConfig;
159
- console.log(
160
- "After Content-Layout: " +
161
- JSON.stringify(this._coveoAdvancedQueryConfig)
162
- );
163
- return this._coveoAdvancedQueryConfig;
164
- }
165
-
166
127
  connectedCallback(): void {
167
128
  const hasParentHighlightListener = closest(
168
129
  "doc-xml-content",