@salesforcedevs/docs-components 1.17.5-search-alpha → 1.17.5-search-alpha2
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 +1 -1
- package/src/modules/doc/amfReference/amfReference.html +0 -5
- package/src/modules/doc/amfReference/amfReference.ts +5 -37
- package/src/modules/doc/amfReference/types.ts +1 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +0 -5
- package/src/modules/doc/xmlContent/xmlContent.html +0 -5
- package/src/modules/doc/xmlContent/xmlContent.ts +5 -44
package/package.json
CHANGED
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
<doc-content-layout
|
|
3
3
|
lwc:if={isVersionFetched}
|
|
4
4
|
class="content-type content-type-reference"
|
|
5
|
-
coveo-organization-id={coveoOrganizationId}
|
|
6
|
-
coveo-public-access-token={coveoPublicAccessToken}
|
|
7
|
-
coveo-analytics-token={coveoAnalyticsToken}
|
|
8
|
-
coveo-search-hub={coveoSearchHub}
|
|
9
|
-
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
10
5
|
breadcrumbs={breadcrumbs}
|
|
11
6
|
sidebar-header={sidebarHeader}
|
|
12
7
|
sidebar-value={selectedSidebarValue}
|
|
@@ -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
|
|
6
|
+
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
7
7
|
import type { OptionWithLink } from "typings/custom";
|
|
8
8
|
import type {
|
|
9
9
|
AmfConfig,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
} from "./constants";
|
|
29
29
|
import { restoreScroll } from "dx/scrollManager";
|
|
30
30
|
import { DocPhaseInfo } from "typings/custom";
|
|
31
|
-
import {
|
|
31
|
+
import { oldVersionDocInfo } from "docUtils/utils";
|
|
32
32
|
|
|
33
33
|
type NavigationItem = {
|
|
34
34
|
label: string;
|
|
@@ -36,15 +36,12 @@ type NavigationItem = {
|
|
|
36
36
|
isExpanded: boolean;
|
|
37
37
|
children: ParsedMarkdownTopic[];
|
|
38
38
|
isChildrenLoading: boolean;
|
|
39
|
+
endpointNames?: string[];
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
export default class AmfReference extends LightningElement {
|
|
42
43
|
@api breadcrumbs: string | null = null;
|
|
43
44
|
@api sidebarHeader!: string;
|
|
44
|
-
@api coveoOrganizationId!: string;
|
|
45
|
-
@api coveoPublicAccessToken!: string;
|
|
46
|
-
@api coveoAnalyticsToken!: string;
|
|
47
|
-
@api coveoSearchHub!: string;
|
|
48
45
|
@api tocTitle?: string;
|
|
49
46
|
@api tocOptions?: string;
|
|
50
47
|
@api languages!: OptionWithLink[];
|
|
@@ -53,7 +50,6 @@ export default class AmfReference extends LightningElement {
|
|
|
53
50
|
@track navigation = [] as NavigationItem[];
|
|
54
51
|
@track versions: Array<ReferenceVersion> = [];
|
|
55
52
|
@track showVersionBanner = false;
|
|
56
|
-
@track _coveoAdvancedQueryConfig!: { [key: string]: any };
|
|
57
53
|
|
|
58
54
|
// Update this to update what component gets rendered in the content block
|
|
59
55
|
@track
|
|
@@ -159,31 +155,6 @@ export default class AmfReference extends LightningElement {
|
|
|
159
155
|
this._expandChildren = normalizeBoolean(value);
|
|
160
156
|
}
|
|
161
157
|
|
|
162
|
-
/*
|
|
163
|
-
* The get coveoAdvancedQueryConfig() method returns this._coveoAdvancedQueryConfig,
|
|
164
|
-
* but before returning it, it checks if there are multiple versions (this.versions.length > 1)
|
|
165
|
-
* and if a version is selected (this.selectedVersion). If both conditions are met,
|
|
166
|
-
* it updates the version property of this._coveoAdvancedQueryConfig with the selected version.
|
|
167
|
-
*/
|
|
168
|
-
@api
|
|
169
|
-
get coveoAdvancedQueryConfig(): { [key: string]: any } {
|
|
170
|
-
const coveoConfig = this._coveoAdvancedQueryConfig;
|
|
171
|
-
if (this.versions.length > 1 && this.selectedVersion) {
|
|
172
|
-
const currentGAVersionRef = this.versions[0];
|
|
173
|
-
if (this.selectedVersion.id !== currentGAVersionRef.id) {
|
|
174
|
-
// Currently Coveo only supports query without "v"
|
|
175
|
-
const version = this.selectedVersion.id.replace("v", "");
|
|
176
|
-
coveoConfig.version = version;
|
|
177
|
-
this._coveoAdvancedQueryConfig = coveoConfig;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
return this._coveoAdvancedQueryConfig;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
set coveoAdvancedQueryConfig(config) {
|
|
184
|
-
this._coveoAdvancedQueryConfig = toJson(config);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
158
|
private get enableFooter(): boolean {
|
|
188
159
|
return !this.hideFooter;
|
|
189
160
|
}
|
|
@@ -488,7 +459,8 @@ export default class AmfReference extends LightningElement {
|
|
|
488
459
|
amfConfig.isSelected ||
|
|
489
460
|
this.isExpandChildrenEnabled(amfConfig.id),
|
|
490
461
|
children: navItemChildren,
|
|
491
|
-
isChildrenLoading
|
|
462
|
+
isChildrenLoading,
|
|
463
|
+
endpointNames: amfConfig.endpointNames || []
|
|
492
464
|
};
|
|
493
465
|
this.parentReferenceUrls.push(amfConfig.href);
|
|
494
466
|
}
|
|
@@ -1435,10 +1407,6 @@ export default class AmfReference extends LightningElement {
|
|
|
1435
1407
|
metaVal
|
|
1436
1408
|
);
|
|
1437
1409
|
|
|
1438
|
-
logCoveoPageView(
|
|
1439
|
-
this.coveoOrganizationId,
|
|
1440
|
-
this.coveoAnalyticsToken
|
|
1441
|
-
);
|
|
1442
1410
|
this.updateUrlWithSelected(parentReferencePath, metaVal);
|
|
1443
1411
|
this.updateTags(metadata.navTitle);
|
|
1444
1412
|
} else {
|
|
@@ -32,11 +32,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
32
32
|
@api sidebarHeader!: string;
|
|
33
33
|
@api tocTitle!: string;
|
|
34
34
|
@api enableSlotChange = false;
|
|
35
|
-
@api coveoOrganizationId!: string;
|
|
36
|
-
@api coveoPublicAccessToken!: string;
|
|
37
|
-
@api coveoAnalyticsToken!: string;
|
|
38
|
-
@api coveoSearchHub!: string;
|
|
39
|
-
@api coveoAdvancedQueryConfig!: string;
|
|
40
35
|
@api useOldSidebar?: boolean = false;
|
|
41
36
|
@api languages!: OptionWithLink[];
|
|
42
37
|
@api language!: string;
|
|
@@ -2,11 +2,6 @@
|
|
|
2
2
|
<doc-content-layout
|
|
3
3
|
lwc:if={displayContent}
|
|
4
4
|
lwc:ref="docContentLayout"
|
|
5
|
-
coveo-organization-id={coveoOrganizationId}
|
|
6
|
-
coveo-public-access-token={coveoPublicAccessToken}
|
|
7
|
-
coveo-analytics-token={coveoAnalyticsToken}
|
|
8
|
-
coveo-search-hub={coveoSearchHub}
|
|
9
|
-
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
10
5
|
sidebar-header={docTitle}
|
|
11
6
|
sidebar-content={sidebarContent}
|
|
12
7
|
sidebar-value={sidebarValue}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @lwc/lwc/no-document-query */
|
|
2
2
|
import { api, track } from "lwc";
|
|
3
|
-
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
4
3
|
import { FetchContent } from "./utils";
|
|
5
4
|
import {
|
|
6
|
-
CoveoAdvancedQueryXMLConfig,
|
|
7
5
|
DocLanguage,
|
|
8
6
|
DocVersion,
|
|
9
7
|
TreeNode,
|
|
@@ -16,7 +14,7 @@ import {
|
|
|
16
14
|
} from "./types";
|
|
17
15
|
import { SearchSyncer } from "docUtils/searchSyncer";
|
|
18
16
|
import { LightningElementWithState } from "dxBaseElements/lightningElementWithState";
|
|
19
|
-
import {
|
|
17
|
+
import { oldVersionDocInfo } from "docUtils/utils";
|
|
20
18
|
import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
|
|
21
19
|
import { track as trackGTM } from "dxUtils/analytics";
|
|
22
20
|
import DOMPurify from "dompurify";
|
|
@@ -42,10 +40,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
42
40
|
internalLinkClicked: boolean;
|
|
43
41
|
}> {
|
|
44
42
|
@api apiDomain = "https://developer.salesforce.com";
|
|
45
|
-
@api coveoOrganizationId!: string;
|
|
46
|
-
@api coveoPublicAccessToken!: string;
|
|
47
|
-
@api coveoAnalyticsToken!: string;
|
|
48
|
-
@api coveoSearchHub!: string;
|
|
49
43
|
@api hideFooter = false;
|
|
50
44
|
|
|
51
45
|
@api
|
|
@@ -59,15 +53,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
59
53
|
}
|
|
60
54
|
}
|
|
61
55
|
|
|
62
|
-
@api
|
|
63
|
-
get enableCoveo() {
|
|
64
|
-
return this._enableCoveo;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
set enableCoveo(value) {
|
|
68
|
-
this._enableCoveo = normalizeBoolean(value);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
56
|
private availableLanguages: Array<DocLanguage> = [];
|
|
72
57
|
@track private availableVersions: Array<DocVersion> = [];
|
|
73
58
|
private contentProvider?: FetchContent;
|
|
@@ -83,7 +68,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
83
68
|
private docTitle = "";
|
|
84
69
|
private _pathName = "";
|
|
85
70
|
private listenerAttached = false;
|
|
86
|
-
private _enableCoveo?: boolean = false;
|
|
87
71
|
private sidebarFooterContent: SiderbarFooter = { ...defaultSidebarFooter };
|
|
88
72
|
private latestVersion = false;
|
|
89
73
|
private previewVersion = false;
|
|
@@ -260,35 +244,13 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
260
244
|
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
261
245
|
// TODO: we need a better fix for version number check
|
|
262
246
|
return !(
|
|
263
|
-
this.
|
|
264
|
-
this.
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
(this.version?.releaseVersion &&
|
|
268
|
-
parseInt(
|
|
269
|
-
this.version.releaseVersion.replace("v", ""),
|
|
270
|
-
10
|
|
271
|
-
) >= 53))
|
|
247
|
+
!this.version?.releaseVersion ||
|
|
248
|
+
(this.version?.releaseVersion &&
|
|
249
|
+
parseInt(this.version.releaseVersion.replace("v", ""), 10) >=
|
|
250
|
+
53)
|
|
272
251
|
);
|
|
273
252
|
}
|
|
274
253
|
|
|
275
|
-
private get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
|
|
276
|
-
const config: {
|
|
277
|
-
locale?: string;
|
|
278
|
-
topicid?: string;
|
|
279
|
-
version?: string;
|
|
280
|
-
} = {
|
|
281
|
-
locale: this.languageId,
|
|
282
|
-
topicid: this.deliverable
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
if (this.releaseVersionId && this.releaseVersionId !== "noversion") {
|
|
286
|
-
config.version = this.releaseVersionId;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
return config;
|
|
290
|
-
}
|
|
291
|
-
|
|
292
254
|
private get pageHeader(): Header {
|
|
293
255
|
if (!this._pageHeader) {
|
|
294
256
|
this._pageHeader = document.querySelector("doc-header")!;
|
|
@@ -589,7 +551,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
589
551
|
}
|
|
590
552
|
|
|
591
553
|
updateUrl(method = HistoryState.PUSH_STATE): void {
|
|
592
|
-
logCoveoPageView(this.coveoOrganizationId, this.coveoAnalyticsToken);
|
|
593
554
|
window.history[method](
|
|
594
555
|
{},
|
|
595
556
|
"docs",
|