@salesforcedevs/docs-components 0.55.3-dw-locales1 → 0.55.5-alpha01
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
|
@@ -150,11 +150,26 @@ export default class Content extends LightningElement {
|
|
|
150
150
|
is: ContentCallout
|
|
151
151
|
});
|
|
152
152
|
const detailEls = calloutEl.querySelectorAll(
|
|
153
|
-
"p, div.data, ol, ul,
|
|
153
|
+
"p, div.data, ol, ul, p+.codeSection, .mediaBd > span.ph"
|
|
154
154
|
);
|
|
155
155
|
detailEls.forEach((detailEl) => {
|
|
156
|
-
|
|
156
|
+
if (detailEl.innerHTML.trim() !== "") {
|
|
157
|
+
calloutCompEl.appendChild(detailEl);
|
|
158
|
+
}
|
|
157
159
|
});
|
|
160
|
+
|
|
161
|
+
let flag = 1;
|
|
162
|
+
for (let i = 0; i < detailEls.length; i++) {
|
|
163
|
+
flag &= detailEls[i].innerHTML.trim() === "";
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (flag) {
|
|
167
|
+
const codeEls = calloutEl.querySelectorAll(".codeSection");
|
|
168
|
+
codeEls.forEach((codeEl) => {
|
|
169
|
+
calloutCompEl.appendChild(codeEl);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
|
|
158
173
|
const type = calloutEl.querySelector("h4").textContent;
|
|
159
174
|
const typeLower = type.toLowerCase();
|
|
160
175
|
Object.assign(calloutCompEl, {
|
|
@@ -8,18 +8,22 @@ import {
|
|
|
8
8
|
DocumentData,
|
|
9
9
|
DocLanguage,
|
|
10
10
|
DocVersion,
|
|
11
|
+
Labels,
|
|
11
12
|
TreeNode
|
|
12
13
|
} from "./types";
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
const LOCALE_TO_LABEL = {
|
|
16
|
+
"en-us": "language_english",
|
|
17
|
+
"ja-jp": "language_japanese"
|
|
18
|
+
};
|
|
15
19
|
|
|
16
20
|
export class FetchContent {
|
|
17
21
|
private apiDomain: string;
|
|
18
|
-
private
|
|
22
|
+
private labels: Labels;
|
|
19
23
|
|
|
20
|
-
constructor(apiDomain: string,
|
|
24
|
+
constructor(apiDomain: string, labels: Labels) {
|
|
21
25
|
this.apiDomain = apiDomain;
|
|
22
|
-
this.
|
|
26
|
+
this.labels = labels;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
async fetchDocumentData(docId: string): Promise<DocumentData | null> {
|
|
@@ -144,10 +148,11 @@ export class FetchContent {
|
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
private normalizeLanguage(language: ApiDocLanguage): DocLanguage {
|
|
147
|
-
|
|
151
|
+
const labelKey = language.locale && LOCALE_TO_LABEL[language.locale];
|
|
148
152
|
return (
|
|
149
153
|
language && {
|
|
150
|
-
label:
|
|
154
|
+
label:
|
|
155
|
+
(labelKey && this.labels && this.labels[labelKey]) ||
|
|
151
156
|
language.label,
|
|
152
157
|
id: language.locale,
|
|
153
158
|
code: language.code,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { api, track } from "lwc";
|
|
2
|
+
import { toJson } from "dxUtils/normalizers";
|
|
2
3
|
import { FetchContent } from "./utils";
|
|
3
4
|
import {
|
|
4
5
|
CoveoAdvancedQueryXMLConfig,
|
|
5
6
|
DocLanguage,
|
|
6
7
|
DocVersion,
|
|
8
|
+
Labels,
|
|
7
9
|
TreeNode,
|
|
8
10
|
Header,
|
|
9
11
|
HistoryState,
|
|
@@ -11,8 +13,6 @@ import {
|
|
|
11
13
|
} from "./types";
|
|
12
14
|
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
13
15
|
import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
|
|
14
|
-
import { Language } from "typings/custom";
|
|
15
|
-
import { DEFAULT_LANGUAGES } from "dxUtils/constants";
|
|
16
16
|
|
|
17
17
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
18
18
|
const handleContentError = (error): void => console.log(error);
|
|
@@ -27,16 +27,15 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
27
27
|
@api coveoPublicAccessToken!: string;
|
|
28
28
|
|
|
29
29
|
@api
|
|
30
|
-
get
|
|
31
|
-
return this.
|
|
30
|
+
get labels() {
|
|
31
|
+
return this._labels;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
set
|
|
35
|
-
|
|
36
|
-
this._allLanguages = JSON.parse(value);
|
|
37
|
-
}
|
|
34
|
+
set labels(value) {
|
|
35
|
+
this._labels = toJson(value);
|
|
38
36
|
}
|
|
39
37
|
|
|
38
|
+
private _labels: Labels = null;
|
|
40
39
|
private availableLanguages: Array<DocLanguage> = [];
|
|
41
40
|
private availableVersions: Array<DocVersion> = [];
|
|
42
41
|
private contentProvider: FetchContent;
|
|
@@ -88,7 +87,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
88
87
|
shouldStopPropagation: true,
|
|
89
88
|
target: window
|
|
90
89
|
});
|
|
91
|
-
private _allLanguages: Array<Language> = DEFAULT_LANGUAGES;
|
|
92
90
|
|
|
93
91
|
@track private pageReference: PageReference = {};
|
|
94
92
|
|
|
@@ -111,10 +109,8 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
111
109
|
window.location.href = "/docs";
|
|
112
110
|
return;
|
|
113
111
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.allLanguages
|
|
117
|
-
);
|
|
112
|
+
|
|
113
|
+
this.contentProvider = new FetchContent(this.apiDomain, this._labels);
|
|
118
114
|
this.fetchDocument().then(() => (this.loaded = true));
|
|
119
115
|
window.addEventListener("popstate", this.handlePopState);
|
|
120
116
|
|
|
@@ -184,17 +180,24 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
184
180
|
return this.pageReference.deliverable;
|
|
185
181
|
}
|
|
186
182
|
|
|
183
|
+
private get useOldSidebar(): boolean {
|
|
184
|
+
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
185
|
+
// TODO: we need a better fix for version number check
|
|
186
|
+
return !(
|
|
187
|
+
process.env.COVEO_ORGANIZATION_ID &&
|
|
188
|
+
process.env.COVEO_PUBLIC_ACCESS_TOKEN &&
|
|
189
|
+
(!this.version?.releaseVersion ||
|
|
190
|
+
(this.version?.releaseVersion &&
|
|
191
|
+
parseInt(this.version.releaseVersion.replace("v", ""), 10) >
|
|
192
|
+
51))
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
187
196
|
private get coveoAdvancedQueryConfig(): CoveoAdvancedQueryXMLConfig {
|
|
188
197
|
return {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
: {
|
|
193
|
-
objecttype: "HTDeveloperDocumentsC",
|
|
194
|
-
sflocale__c: this.languageId,
|
|
195
|
-
sfrelease__c: this.releaseVersionId,
|
|
196
|
-
sfdelivarable__c: this.deliverable
|
|
197
|
-
})
|
|
198
|
+
locale: this.languageId,
|
|
199
|
+
version: this.releaseVersionId,
|
|
200
|
+
topicid: this.deliverable
|
|
198
201
|
};
|
|
199
202
|
}
|
|
200
203
|
|