@salesforcedevs/docs-components 1.14.8-alpha7 → 1.14.9-playground-404-1
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/componentPlayground/componentPlayground.html +6 -1
- package/src/modules/doc/componentPlayground/componentPlayground.ts +9 -0
- package/src/modules/doc/nav/nav.ts +0 -1
- package/src/modules/doc/xmlContent/utils.ts +10 -10
- package/src/modules/doc/xmlContent/xmlContent.ts +15 -23
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="container">
|
|
2
|
+
<div class="container" if:true={playgroundAvailable}>
|
|
3
3
|
<dx-spinner
|
|
4
4
|
size="large"
|
|
5
5
|
variant="brand"
|
|
@@ -12,4 +12,9 @@
|
|
|
12
12
|
allow="clipboard-write"
|
|
13
13
|
></iframe>
|
|
14
14
|
</div>
|
|
15
|
+
<dx-error-fallback
|
|
16
|
+
if:false={playgroundAvailable}
|
|
17
|
+
title="Playground Unavailable"
|
|
18
|
+
description="This component's playground is currently unavailable. Please check again later."
|
|
19
|
+
></dx-error-fallback>
|
|
15
20
|
</template>
|
|
@@ -8,6 +8,15 @@ export default class ComponentPlayground extends LightningElement {
|
|
|
8
8
|
|
|
9
9
|
isLoading = true;
|
|
10
10
|
|
|
11
|
+
get playgroundAvailable() {
|
|
12
|
+
return (
|
|
13
|
+
this.playgroundAppUrl &&
|
|
14
|
+
this.model &&
|
|
15
|
+
this.namespace &&
|
|
16
|
+
this.component
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
11
20
|
get playgroundSrc(): string {
|
|
12
21
|
return `${this.playgroundAppUrl}/playground/${this.model}/${
|
|
13
22
|
this.namespace
|
|
@@ -21,7 +21,6 @@ export default class Nav extends LightningElement {
|
|
|
21
21
|
@api pageReference!: PageReference;
|
|
22
22
|
|
|
23
23
|
handleSelected(event: CustomEvent) {
|
|
24
|
-
event.preventDefault();
|
|
25
24
|
event.stopPropagation();
|
|
26
25
|
const newPageReference = { ...this.pageReference };
|
|
27
26
|
const target = event.detail.name.split("-");
|
|
@@ -38,11 +38,9 @@ export class FetchContent {
|
|
|
38
38
|
pdf_url,
|
|
39
39
|
deliverable
|
|
40
40
|
} = await this.fetchResource<ApiDocData>(
|
|
41
|
-
|
|
41
|
+
`${this.apiDomain}/docs/get_document/${docId}`
|
|
42
42
|
);
|
|
43
43
|
|
|
44
|
-
console.log(docId);
|
|
45
|
-
|
|
46
44
|
const { normalizedToc, tocMap } = this.normalizeToc(toc);
|
|
47
45
|
return {
|
|
48
46
|
availableLanguages:
|
|
@@ -72,24 +70,26 @@ export class FetchContent {
|
|
|
72
70
|
deliverable: string,
|
|
73
71
|
contentId: string,
|
|
74
72
|
options: ContentApiOptions
|
|
75
|
-
): Promise<
|
|
76
|
-
return this.fetchResource<
|
|
77
|
-
|
|
73
|
+
): Promise<ContentData> {
|
|
74
|
+
return this.fetchResource<ContentData>(
|
|
75
|
+
`${this.apiDomain}/docs/get_document_content/${deliverable}/${contentId}/${options.language}/${options.version}`
|
|
78
76
|
);
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
private async fetchResource<T>(url: string): Promise<T> {
|
|
82
80
|
const response = await fetch(url);
|
|
83
|
-
|
|
81
|
+
if (!response.ok) {
|
|
84
82
|
throw new Error(response.statusText);
|
|
85
|
-
}
|
|
83
|
+
}
|
|
86
84
|
|
|
87
85
|
const json = await response.json();
|
|
88
86
|
|
|
89
|
-
return json
|
|
87
|
+
return json;
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
private normalizeToc(
|
|
90
|
+
private normalizeToc(
|
|
91
|
+
apiToc: Array<ApiNavItem>
|
|
92
|
+
): {
|
|
93
93
|
tocMap: { [key: string]: TreeNode };
|
|
94
94
|
normalizedToc: Array<TreeNode>;
|
|
95
95
|
} {
|
|
@@ -251,18 +251,17 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
251
251
|
private get useOldSidebar(): boolean {
|
|
252
252
|
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
253
253
|
// TODO: we need a better fix for version number check
|
|
254
|
-
return
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
// );
|
|
254
|
+
return !(
|
|
255
|
+
this.enableCoveo &&
|
|
256
|
+
this.coveoOrganizationId &&
|
|
257
|
+
this.coveoPublicAccessToken &&
|
|
258
|
+
(!this.version?.releaseVersion ||
|
|
259
|
+
(this.version?.releaseVersion &&
|
|
260
|
+
parseInt(
|
|
261
|
+
this.version.releaseVersion.replace("v", ""),
|
|
262
|
+
10
|
|
263
|
+
) >= 53))
|
|
264
|
+
);
|
|
266
265
|
}
|
|
267
266
|
|
|
268
267
|
private get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
|
|
@@ -347,7 +346,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
347
346
|
}
|
|
348
347
|
|
|
349
348
|
handleSelect(event: CustomEvent<{ name: string }>): void {
|
|
350
|
-
event.preventDefault();
|
|
351
349
|
event.stopPropagation();
|
|
352
350
|
const { name } = event.detail;
|
|
353
351
|
|
|
@@ -366,18 +364,15 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
366
364
|
contentDocumentId,
|
|
367
365
|
hash
|
|
368
366
|
});
|
|
369
|
-
this.updateUrl(
|
|
370
|
-
// Prevent default navigation
|
|
371
|
-
event.preventDefault();
|
|
367
|
+
this.updateUrl();
|
|
372
368
|
}
|
|
373
369
|
}
|
|
374
370
|
|
|
375
371
|
handleNavClick(event: CustomEvent<{ pageReference: PageReference }>): void {
|
|
376
|
-
event.preventDefault();
|
|
377
372
|
event.stopPropagation();
|
|
378
373
|
const { pageReference } = event.detail;
|
|
379
374
|
this.updatePageReference(pageReference);
|
|
380
|
-
this.updateUrl(
|
|
375
|
+
this.updateUrl();
|
|
381
376
|
}
|
|
382
377
|
|
|
383
378
|
handleLanguageChange = (event: any) => {
|
|
@@ -548,7 +543,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
548
543
|
);
|
|
549
544
|
|
|
550
545
|
if (data) {
|
|
551
|
-
this.docContent =
|
|
546
|
+
this.docContent = data.content;
|
|
552
547
|
this.addMetatags();
|
|
553
548
|
|
|
554
549
|
if (!this.pageReference.hash) {
|
|
@@ -585,14 +580,11 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
585
580
|
|
|
586
581
|
updateUrl(method = HistoryState.PUSH_STATE): void {
|
|
587
582
|
logCoveoPageView(this.coveoOrganizationId, this.coveoAnalyticsToken);
|
|
588
|
-
const url = this.pageReferenceToString(this.pageReference);
|
|
589
583
|
window.history[method](
|
|
590
584
|
{},
|
|
591
585
|
"docs",
|
|
592
|
-
|
|
586
|
+
this.pageReferenceToString(this.pageReference)
|
|
593
587
|
);
|
|
594
|
-
// Prevent default navigation
|
|
595
|
-
event?.preventDefault();
|
|
596
588
|
}
|
|
597
589
|
|
|
598
590
|
private updateHighlighting(searchParam: string): void {
|