@salesforcedevs/docs-components 1.27.22-banner7 → 1.27.22-banner9
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.27.22-
|
|
3
|
+
"version": "1.27.22-banner9",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/lodash.orderby": "4.6.9",
|
|
26
26
|
"@types/lodash.uniqby": "4.7.9"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "6bfe41efab500f95128e0dd50057065992d724ad"
|
|
29
29
|
}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
>
|
|
18
18
|
<doc-banner
|
|
19
19
|
slot="locale-banner"
|
|
20
|
-
lwc:if={
|
|
20
|
+
lwc:if={showLocaleBannerInSlot}
|
|
21
21
|
message-text="This text was translated using Salesforce's machine translation system. More details can be found "
|
|
22
22
|
message-link-url="https://help.salesforce.com/s/articleView?id=sf.machine_translation.htm"
|
|
23
23
|
message-link-text="here"
|
|
@@ -80,6 +80,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
80
80
|
private docTitle = "";
|
|
81
81
|
private _pathName = "";
|
|
82
82
|
private listenerAttached = false;
|
|
83
|
+
private _xmlLocaleBannerDispatched = false;
|
|
83
84
|
private sidebarFooterContent: SiderbarFooter = { ...defaultSidebarFooter };
|
|
84
85
|
private latestVersion = false;
|
|
85
86
|
private previewVersion = false;
|
|
@@ -221,6 +222,16 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
221
222
|
this.setState({ internalLinkClicked: false });
|
|
222
223
|
}
|
|
223
224
|
|
|
225
|
+
if (
|
|
226
|
+
this.displayContent &&
|
|
227
|
+
!normalizeBoolean(this.localeBannerEnabled) &&
|
|
228
|
+
this.shouldShowLocaleBanner &&
|
|
229
|
+
!this._xmlLocaleBannerDispatched
|
|
230
|
+
) {
|
|
231
|
+
this._xmlLocaleBannerDispatched = true;
|
|
232
|
+
this.injectLocaleBannerIntoThemeHost();
|
|
233
|
+
}
|
|
234
|
+
|
|
224
235
|
if (
|
|
225
236
|
(this.prevState.isFetchingContent &&
|
|
226
237
|
!this.state.isFetchingContent) ||
|
|
@@ -257,10 +268,14 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
257
268
|
return this.pageReference.deliverable;
|
|
258
269
|
}
|
|
259
270
|
|
|
260
|
-
private get
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
271
|
+
private get showLocaleBannerInSlot(): boolean {
|
|
272
|
+
return (
|
|
273
|
+
normalizeBoolean(this.localeBannerEnabled) &&
|
|
274
|
+
this.shouldShowLocaleBanner
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private get shouldShowLocaleBanner(): boolean {
|
|
264
279
|
if (!this.pageReference?.deliverable) {
|
|
265
280
|
return false;
|
|
266
281
|
}
|
|
@@ -289,6 +304,45 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
289
304
|
});
|
|
290
305
|
}
|
|
291
306
|
|
|
307
|
+
private injectLocaleBannerIntoThemeHost(retry = false): void {
|
|
308
|
+
if (typeof document === "undefined") {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const host = document.getElementById("doc-xml-locale-banner-host");
|
|
312
|
+
if (!host) {
|
|
313
|
+
if (!retry) {
|
|
314
|
+
setTimeout(
|
|
315
|
+
() => this.injectLocaleBannerIntoThemeHost(true),
|
|
316
|
+
100
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
if (host.hasChildNodes()) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const banner = document.createElement("doc-banner");
|
|
325
|
+
banner.setAttribute(
|
|
326
|
+
"message-text",
|
|
327
|
+
"This text was translated using Salesforce's machine translation system. More details can be found "
|
|
328
|
+
);
|
|
329
|
+
banner.setAttribute(
|
|
330
|
+
"message-link-url",
|
|
331
|
+
"https://help.salesforce.com/s/articleView?id=sf.machine_translation.htm"
|
|
332
|
+
);
|
|
333
|
+
banner.setAttribute("message-link-text", "here");
|
|
334
|
+
banner.setAttribute("button-label", "Switch to English");
|
|
335
|
+
banner.setAttribute("button-href", this.localeBannerEnUsHref);
|
|
336
|
+
banner.setAttribute("secondary-label", "Not Now");
|
|
337
|
+
banner.setAttribute("show-close-button", "true");
|
|
338
|
+
banner.setAttribute(
|
|
339
|
+
"dismiss-storage-key",
|
|
340
|
+
this.deliverable || "default"
|
|
341
|
+
);
|
|
342
|
+
host.setAttribute("aria-hidden", "false");
|
|
343
|
+
host.appendChild(banner);
|
|
344
|
+
}
|
|
345
|
+
|
|
292
346
|
private get useOldSidebar(): boolean {
|
|
293
347
|
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
294
348
|
// TODO: we need a better fix for version number check
|