@salesforcedevs/docs-components 1.3.138-coveo-alpha4 → 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-alpha4",
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,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>;