@salesforcedevs/docs-components 1.3.221 → 1.3.227

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.221",
3
+ "version": "1.3.227",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "eca6f0494621686d4b7c408a316e8b230b09b6dc"
27
+ "gitHead": "ca4d2f11924db69bc1e872fb61587af9bb78cdde"
28
28
  }
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <doc-content-layout
3
+ if:true={isVersionFetched}
3
4
  use-old-sidebar={useOldSidebar}
4
5
  class="content-type content-type-reference"
5
6
  coveo-organization-id={coveoOrganizationId}
@@ -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 "doc/amfModelParser";
6
- import { normalizeBoolean } from "dxUtils/normalizers";
6
+ import { normalizeBoolean, toJson } from "dxUtils/normalizers";
7
7
  import type {
8
8
  AmfConfig,
9
9
  AmfMetadataTopic,
@@ -43,7 +43,6 @@ export default class AmfReference extends LightningElement {
43
43
  @api coveoOrganizationId!: string;
44
44
  @api coveoPublicAccessToken!: string;
45
45
  @api coveoAnalyticsToken!: string;
46
- @api coveoAdvancedQueryConfig!: string;
47
46
  @api coveoSearchHub!: string;
48
47
  @api useOldSidebar: boolean = false;
49
48
  @api tocTitle?: string;
@@ -51,6 +50,7 @@ export default class AmfReference extends LightningElement {
51
50
  @track navigation = [] as NavigationItem[];
52
51
  @track versions: Array<ReferenceVersion> = [];
53
52
  @track showVersionBanner = false;
53
+ @track _coveoAdvancedQueryConfig!: { [key: string]: any };
54
54
 
55
55
  // Update this to update what component gets rendered in the content block
56
56
  @track
@@ -114,12 +114,14 @@ export default class AmfReference extends LightningElement {
114
114
  this.versions = this.getVersions();
115
115
  }
116
116
  this.selectedVersion = selectedVersion;
117
- if (
118
- this.isSpecBasedReference(this._currentReferenceId) &&
119
- this.oldVersionInfo
120
- ) {
121
- this.showVersionBanner = true;
117
+ if (this.isSpecBasedReference(this._currentReferenceId)) {
118
+ this.isVersionFetched = true;
119
+ if (this.oldVersionInfo) {
120
+ this.showVersionBanner = true;
121
+ }
122
122
  }
123
+ } else {
124
+ this.isVersionFetched = true;
123
125
  }
124
126
 
125
127
  // This is to check if the url is hash based and redirect if needed
@@ -152,6 +154,31 @@ export default class AmfReference extends LightningElement {
152
154
  this._expandChildren = normalizeBoolean(value);
153
155
  }
154
156
 
157
+ /*
158
+ * The get coveoAdvancedQueryConfig() method returns this._coveoAdvancedQueryConfig,
159
+ * but before returning it, it checks if there are multiple versions (this.versions.length > 1)
160
+ * and if a version is selected (this.selectedVersion). If both conditions are met,
161
+ * it updates the version property of this._coveoAdvancedQueryConfig with the selected version.
162
+ */
163
+ @api
164
+ get coveoAdvancedQueryConfig(): { [key: string]: any } {
165
+ const coveoConfig = this._coveoAdvancedQueryConfig;
166
+ if (this.versions.length > 1 && this.selectedVersion) {
167
+ const currentGAVersionRef = this.versions[0];
168
+ if (this.selectedVersion.id !== currentGAVersionRef.id) {
169
+ // Currently Coveo only supports query without "v"
170
+ const version = this.selectedVersion.id.replace("v", "");
171
+ coveoConfig.version = version;
172
+ this._coveoAdvancedQueryConfig = coveoConfig;
173
+ }
174
+ }
175
+ return this._coveoAdvancedQueryConfig;
176
+ }
177
+
178
+ set coveoAdvancedQueryConfig(config) {
179
+ this._coveoAdvancedQueryConfig = toJson(config);
180
+ }
181
+
155
182
  // model
156
183
  protected _amfConfigList: AmfConfig[] = [];
157
184
  protected _amfConfigMap: Map<string, AmfConfig> = new Map();
@@ -172,6 +199,7 @@ export default class AmfReference extends LightningElement {
172
199
  private isParentLevelDocPhaseEnabled = false;
173
200
  private selectedReferenceDocPhase?: string | null = null;
174
201
  private _expandChildren?: boolean = false;
202
+ private isVersionFetched = false;
175
203
 
176
204
  /**
177
205
  * Key for storing the currently selected reference url. This will be used to save the
@@ -1284,6 +1312,7 @@ export default class AmfReference extends LightningElement {
1284
1312
  this.showVersionBanner = true;
1285
1313
  }
1286
1314
 
1315
+ this.isVersionFetched = true;
1287
1316
  this.updateDocPhase();
1288
1317
  this.selectedSidebarValue = window.location.pathname;
1289
1318
  }