@salesforcedevs/docs-components 1.3.209 → 1.3.219-coveoversion-alpha4
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.
|
|
3
|
+
"version": "1.3.219-coveoversion-alpha4",
|
|
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": "
|
|
27
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
28
28
|
}
|
|
@@ -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 loaded = false;
|
|
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.
|
|
119
|
-
this.oldVersionInfo
|
|
120
|
-
|
|
121
|
-
|
|
117
|
+
if (this.isSpecBasedReference(this._currentReferenceId)) {
|
|
118
|
+
this.loaded = true;
|
|
119
|
+
if (this.oldVersionInfo) {
|
|
120
|
+
this.showVersionBanner = true;
|
|
121
|
+
}
|
|
122
122
|
}
|
|
123
|
+
} else {
|
|
124
|
+
this.loaded = true;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
// This is to check if the url is hash based and redirect if needed
|
|
@@ -152,6 +154,25 @@ export default class AmfReference extends LightningElement {
|
|
|
152
154
|
this._expandChildren = normalizeBoolean(value);
|
|
153
155
|
}
|
|
154
156
|
|
|
157
|
+
@api
|
|
158
|
+
get coveoAdvancedQueryConfig(): { [key: string]: any } {
|
|
159
|
+
const coveoConfig = this._coveoAdvancedQueryConfig;
|
|
160
|
+
if (this.versions.length > 1 && this.selectedVersion) {
|
|
161
|
+
const currentGAVersionRef = this.versions[0];
|
|
162
|
+
if (this.selectedVersion.id !== currentGAVersionRef.id) {
|
|
163
|
+
// Currently Coveo only supports query without "v"
|
|
164
|
+
const version = this.selectedVersion.id.replace("v", "");
|
|
165
|
+
coveoConfig.version = version;
|
|
166
|
+
this._coveoAdvancedQueryConfig = coveoConfig;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return this._coveoAdvancedQueryConfig;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
set coveoAdvancedQueryConfig(config) {
|
|
173
|
+
this._coveoAdvancedQueryConfig = toJson(config);
|
|
174
|
+
}
|
|
175
|
+
|
|
155
176
|
// model
|
|
156
177
|
protected _amfConfigList: AmfConfig[] = [];
|
|
157
178
|
protected _amfConfigMap: Map<string, AmfConfig> = new Map();
|
|
@@ -172,6 +193,7 @@ export default class AmfReference extends LightningElement {
|
|
|
172
193
|
private isParentLevelDocPhaseEnabled = false;
|
|
173
194
|
private selectedReferenceDocPhase?: string | null = null;
|
|
174
195
|
private _expandChildren?: boolean = false;
|
|
196
|
+
private _coveoAdvancedQueryConfig!: { [key: string]: any };
|
|
175
197
|
|
|
176
198
|
/**
|
|
177
199
|
* Key for storing the currently selected reference url. This will be used to save the
|
|
@@ -207,9 +207,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
207
207
|
".sticky-doc-header"
|
|
208
208
|
) as HTMLElement;
|
|
209
209
|
|
|
210
|
-
const docPhaseEl = (
|
|
211
|
-
"[name=doc-phase]"
|
|
212
|
-
)
|
|
210
|
+
const docPhaseEl = (
|
|
211
|
+
this.template.querySelector("[name=doc-phase]")! as any
|
|
212
|
+
).assignedElements()[0] as HTMLSlotElement;
|
|
213
213
|
|
|
214
214
|
if (!sidebarEl || !globalNavEl || !contextNavEl || !docHeaderEl) {
|
|
215
215
|
console.warn("One or more required elements are missing.");
|
|
@@ -259,9 +259,8 @@ export default class ContentLayout extends LightningElement {
|
|
|
259
259
|
});
|
|
260
260
|
|
|
261
261
|
// Adjust right nav bar position when doc phase is present
|
|
262
|
-
const rightNavBarEl =
|
|
263
|
-
".right-nav-bar"
|
|
264
|
-
);
|
|
262
|
+
const rightNavBarEl =
|
|
263
|
+
this.template.querySelector(".right-nav-bar");
|
|
265
264
|
|
|
266
265
|
if (rightNavBarEl) {
|
|
267
266
|
rightNavBarEl.style.top = `${
|
|
@@ -323,14 +322,17 @@ export default class ContentLayout extends LightningElement {
|
|
|
323
322
|
};
|
|
324
323
|
|
|
325
324
|
onSlotChange(event: Event): void {
|
|
326
|
-
const slotElements = (
|
|
325
|
+
const slotElements = (
|
|
326
|
+
event.target as HTMLSlotElement
|
|
327
|
+
).assignedElements();
|
|
327
328
|
|
|
328
329
|
if (slotElements.length) {
|
|
329
330
|
this.contentLoaded = true;
|
|
330
331
|
const slotContentElement = slotElements[0];
|
|
331
|
-
const headingElements =
|
|
332
|
-
|
|
333
|
-
|
|
332
|
+
const headingElements =
|
|
333
|
+
slotContentElement.ownerDocument?.getElementsByTagName(
|
|
334
|
+
TOC_HEADER_TAG
|
|
335
|
+
);
|
|
334
336
|
|
|
335
337
|
for (const headingElement of headingElements as any) {
|
|
336
338
|
// Sometimes elements hash is not being set when slot content is wrapped with div
|
|
@@ -390,9 +392,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
390
392
|
globalNavEl?.offsetHeight +
|
|
391
393
|
contextNavEl?.offsetHeight;
|
|
392
394
|
|
|
393
|
-
const docPhaseEl = (
|
|
394
|
-
"[name=doc-phase]"
|
|
395
|
-
)
|
|
395
|
+
const docPhaseEl = (
|
|
396
|
+
this.template.querySelector("[name=doc-phase]")! as any
|
|
397
|
+
).assignedElements()[0] as HTMLSlotElement;
|
|
396
398
|
|
|
397
399
|
const offset = docPhaseEl
|
|
398
400
|
? headerHeight + docPhaseEl.offsetHeight
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
-
All rights reserved.
|
|
3
|
-
|
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
-
|
|
6
|
-
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
-
|
|
8
|
-
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
-
|
|
10
|
-
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
-
|
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|