@salesforcedevs/docs-components 1.3.138-coveo-alpha4 → 1.3.138-coveo-fix2

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-alpha4",
3
+ "version": "1.3.138-coveo-fix2",
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,26 @@ 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
+ const coveoConfig = toJson(this._coveoAdvancedQueryConfig);
148
+ if (this.versions.length > 1 && this.selectedVersion) {
149
+ const currentGAVersionRef = this.versions[0];
150
+ if (this.selectedVersion.id !== currentGAVersionRef.id) {
151
+ coveoConfig.version = this.selectedVersion.id.replace("v", "");
152
+ this._coveoAdvancedQueryConfig = coveoConfig;
153
+ }
154
+ }
155
+ console.log(
156
+ "AQ AMF Ref: " + JSON.stringify(this._coveoAdvancedQueryConfig)
157
+ );
158
+ return this._coveoAdvancedQueryConfig;
159
+ }
160
+
161
+ set coveoAdvancedQueryConfig(config) {
162
+ this._coveoAdvancedQueryConfig = config;
163
+ }
164
+
160
165
  // model
161
166
  protected _amfConfigList: AmfConfig[] = [];
162
167
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
@@ -171,13 +176,14 @@ export default class AmfReference extends LightningElement {
171
176
  protected selectedSidebarValue = undefined;
172
177
 
173
178
  protected selectedVersion: ReferenceVersion | null = null;
174
- protected versionForCoveo: string = "latest";
175
179
 
176
180
  private hasRendered = false;
177
181
 
178
182
  private isParentLevelDocPhaseEnabled = false;
179
183
  private selectedReferenceDocPhase?: string | null = null;
180
184
  private _expandChildren?: boolean = false;
185
+ private loaded = false;
186
+ private _coveoAdvancedQueryConfig!: { [key: string]: any };
181
187
 
182
188
  /**
183
189
  * Key for storing the currently selected reference url. This will be used to save the
@@ -198,6 +204,7 @@ export default class AmfReference extends LightningElement {
198
204
  }
199
205
 
200
206
  connectedCallback(): void {
207
+ this.loaded = true;
201
208
  this.addEventListener(
202
209
  "api-navigation-selection-changed",
203
210
  this._boundOnApiNavigationChanged
@@ -17,8 +17,7 @@
17
17
  trees={sidebarContent}
18
18
  value={sidebarValue}
19
19
  header={sidebarHeader}
20
- version={version}
21
- coveo-organization-id={coveoAdvancedQueryConfig}
20
+ coveo-organization-id={coveoOrganizationId}
22
21
  coveo-public-access-token={coveoPublicAccessToken}
23
22
  coveo-search-hub={coveoSearchHub}
24
23
  coveo-advanced-query-config={coveoAdvancedQueryConfig}
@@ -34,8 +34,6 @@ export default class ContentLayout extends LightningElement {
34
34
  @api coveoPublicAccessToken!: string;
35
35
  @api coveoSearchHub!: string;
36
36
  @api coveoAdvancedQueryConfig!: string;
37
- @api version!: string;
38
-
39
37
  @api useOldSidebar?: boolean = false;
40
38
 
41
39
  @api
@@ -76,7 +74,6 @@ export default class ContentLayout extends LightningElement {
76
74
  private _sidebarContent: unknown;
77
75
 
78
76
  private _breadcrumbs = null;
79
- protected _newVersion: string = "latest";
80
77
 
81
78
  @track
82
79
  private _tocOptions: Array<unknown>;