@salesforcedevs/docs-components 1.28.7-alpha.8 → 1.28.7
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/lwc.config.json +2 -0
- package/package.json +3 -3
- package/src/modules/doc/banner/banner.css +88 -0
- package/src/modules/doc/banner/banner.html +47 -0
- package/src/modules/doc/banner/banner.ts +73 -0
- package/src/modules/doc/contentLayout/contentLayout.html +1 -12
- package/src/modules/doc/contentLayout/contentLayout.ts +42 -14
- package/src/modules/doc/localeBanner/localeBanner.css +3 -0
- package/src/modules/doc/localeBanner/localeBanner.html +9 -0
- package/src/modules/doc/localeBanner/localeBanner.ts +195 -0
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +5 -13
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +11 -0
- package/src/modules/doc/redocReference/redocReference.ts +16 -2
- package/src/modules/doc/xmlContent/xmlContent.html +1 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +49 -10
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.28.7
|
|
3
|
+
"version": "1.28.7",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "
|
|
8
|
+
"node": "22.x"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -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": "aedcb1c0ab8cb16ff85f61c0d3ed0c908502d843"
|
|
29
29
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/text";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
|
|
7
|
+
--doc-banner-padding-left: var(--dx-g-spacing-2xl);
|
|
8
|
+
--doc-banner-padding-right: var(--dx-g-spacing-lg);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.container {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: flex-start;
|
|
14
|
+
background: var(--dx-g-gray-90);
|
|
15
|
+
padding: 0 var(--doc-banner-padding-right) 0 var(--doc-banner-padding-left);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.icon {
|
|
19
|
+
--dx-c-icon-size: var(--dx-g-icon-size-lg);
|
|
20
|
+
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
margin-top: var(--dx-g-spacing-smd);
|
|
23
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.main {
|
|
27
|
+
flex: 1;
|
|
28
|
+
min-width: 0;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-wrap: wrap;
|
|
31
|
+
align-items: flex-start;
|
|
32
|
+
column-gap: var(--dx-g-spacing-md);
|
|
33
|
+
padding: calc((var(--dx-g-spacing-xs) + var(--dx-g-spacing-sm)) / 2) 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.message {
|
|
37
|
+
flex: 0 1 auto;
|
|
38
|
+
font-size: var(--dx-g-text-sm);
|
|
39
|
+
color: var(--dx-g-gray-10);
|
|
40
|
+
padding: calc((var(--dx-g-spacing-xs) + var(--dx-g-spacing-sm)) / 2) 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.message a {
|
|
44
|
+
color: var(--dx-g-cloud-blue-vibrant-50);
|
|
45
|
+
text-decoration: underline;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.actions {
|
|
49
|
+
flex: 0 0 auto;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: var(--dx-g-spacing-smd);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.actions dx-button {
|
|
56
|
+
--dx-c-button-font-size: var(--dx-g-text-sm);
|
|
57
|
+
--dx-c-button-font-weight: var(--dx-g-font-normal);
|
|
58
|
+
|
|
59
|
+
flex: 0 0 auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.close {
|
|
63
|
+
--dx-c-icon-size: var(--dx-g-icon-size-lg);
|
|
64
|
+
|
|
65
|
+
flex-shrink: 0;
|
|
66
|
+
align-self: flex-start;
|
|
67
|
+
width: calc(var(--dx-g-spacing-3xl) + var(--dx-g-spacing-xs));
|
|
68
|
+
height: calc(var(--dx-g-spacing-2xl) + var(--dx-g-spacing-xs));
|
|
69
|
+
margin-left: auto;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
cursor: pointer;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@media (max-width: 1279px) {
|
|
77
|
+
:host {
|
|
78
|
+
--doc-banner-padding-left: var(--dx-g-spacing-xl);
|
|
79
|
+
--doc-banner-padding-right: var(--dx-g-spacing-md);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media (max-width: 768px) {
|
|
84
|
+
:host {
|
|
85
|
+
--doc-banner-padding-left: var(--dx-g-spacing-lg);
|
|
86
|
+
--doc-banner-padding-right: var(--dx-g-spacing-sm);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template lwc:if={showBanner}>
|
|
3
|
+
<div class="container" part="container">
|
|
4
|
+
<dx-icon
|
|
5
|
+
class="icon"
|
|
6
|
+
symbol="info"
|
|
7
|
+
size="override"
|
|
8
|
+
color="gray-50"
|
|
9
|
+
part="icon"
|
|
10
|
+
></dx-icon>
|
|
11
|
+
<div class="main">
|
|
12
|
+
<div class="message" part="message" lwc:dom="manual"></div>
|
|
13
|
+
<div class="actions" part="actions">
|
|
14
|
+
<template lwc:if={hasPrimaryButton}>
|
|
15
|
+
<dx-button
|
|
16
|
+
href={buttonHref}
|
|
17
|
+
variant="primary"
|
|
18
|
+
size="small"
|
|
19
|
+
part="button"
|
|
20
|
+
>
|
|
21
|
+
{buttonLabel}
|
|
22
|
+
</dx-button>
|
|
23
|
+
</template>
|
|
24
|
+
<template lwc:if={hasSecondaryAction}>
|
|
25
|
+
<dx-button
|
|
26
|
+
variant="inline"
|
|
27
|
+
onclick={handleSecondaryClick}
|
|
28
|
+
part="secondary"
|
|
29
|
+
>
|
|
30
|
+
{secondaryLabel}
|
|
31
|
+
</dx-button>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
<dx-button
|
|
36
|
+
class="close"
|
|
37
|
+
variant="icon-only"
|
|
38
|
+
icon-symbol="close"
|
|
39
|
+
icon-size="override"
|
|
40
|
+
icon-color="gray-50"
|
|
41
|
+
aria-label="Close"
|
|
42
|
+
onclick={handleCloseClick}
|
|
43
|
+
part="close"
|
|
44
|
+
></dx-button>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
const BANNER_STORAGE_PREFIX = "doc-banner-";
|
|
4
|
+
|
|
5
|
+
export default class Banner extends LightningElement {
|
|
6
|
+
@api message = "";
|
|
7
|
+
|
|
8
|
+
@api buttonLabel = "";
|
|
9
|
+
|
|
10
|
+
@api buttonHref = "";
|
|
11
|
+
|
|
12
|
+
@api secondaryLabel = "";
|
|
13
|
+
|
|
14
|
+
@api dismissStorageKey = "";
|
|
15
|
+
|
|
16
|
+
private _dismissed = false;
|
|
17
|
+
|
|
18
|
+
connectedCallback() {
|
|
19
|
+
if (this.dismissStorageKey && window?.sessionStorage) {
|
|
20
|
+
this._dismissed =
|
|
21
|
+
window.sessionStorage.getItem(
|
|
22
|
+
`${BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`
|
|
23
|
+
) === "true";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
renderedCallback() {
|
|
28
|
+
if (this.message) {
|
|
29
|
+
const messageElement = this.template.querySelector(".message");
|
|
30
|
+
if (messageElement) {
|
|
31
|
+
messageElement.innerHTML = this.message;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get showBanner(): boolean {
|
|
37
|
+
return !this._dismissed;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get hasPrimaryButton(): boolean {
|
|
41
|
+
return !!(this.buttonLabel && this.buttonHref);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get hasSecondaryAction(): boolean {
|
|
45
|
+
return !!this.secondaryLabel;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private dismissBanner() {
|
|
49
|
+
if (this.dismissStorageKey && window?.sessionStorage) {
|
|
50
|
+
window.sessionStorage.setItem(
|
|
51
|
+
`${BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`,
|
|
52
|
+
"true"
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
this._dismissed = true;
|
|
56
|
+
this.dispatchEvent(
|
|
57
|
+
new CustomEvent("dismissbanner", {
|
|
58
|
+
bubbles: true,
|
|
59
|
+
composed: true
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@api
|
|
65
|
+
handleSecondaryClick() {
|
|
66
|
+
this.dismissBanner();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@api
|
|
70
|
+
handleCloseClick() {
|
|
71
|
+
this.dismissBanner();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="content">
|
|
3
|
-
<dx-sidebar
|
|
4
|
-
lwc:if={showDataCloudSidebar}
|
|
5
|
-
class="is-sticky left-nav-bar"
|
|
6
|
-
trees={sidebarContent}
|
|
7
|
-
value={sidebarValue}
|
|
8
|
-
header={sidebarHeader}
|
|
9
|
-
ontogglesidebar={onToggleSidebar}
|
|
10
|
-
>
|
|
11
|
-
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
12
|
-
</dx-sidebar>
|
|
13
3
|
<dx-sidebar-old
|
|
14
|
-
lwc:else
|
|
15
4
|
class="is-sticky left-nav-bar"
|
|
16
5
|
trees={sidebarContent}
|
|
17
6
|
value={sidebarValue}
|
|
@@ -54,7 +43,7 @@
|
|
|
54
43
|
></path>
|
|
55
44
|
</g>
|
|
56
45
|
</svg>
|
|
57
|
-
{
|
|
46
|
+
{readingTimeLabel}
|
|
58
47
|
</div>
|
|
59
48
|
<div class="share-below-read" lwc:if={showSocialShare}>
|
|
60
49
|
<doc-social-share
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @lwc/lwc/no-document-query */
|
|
2
2
|
import { LightningElement, api, track } from "lwc";
|
|
3
3
|
import { closest } from "kagekiri";
|
|
4
|
-
import { fetchHasResults } from "dxUtils/dataCloudSearch";
|
|
5
4
|
import { toJson, normalizeBoolean } from "dxUtils/normalizers";
|
|
6
5
|
import { highlightTerms } from "dxUtils/highlight";
|
|
7
6
|
import { SearchSyncer } from "docUtils/searchSyncer";
|
|
@@ -29,6 +28,35 @@ const HIGHLIGHTABLE_SELECTOR = [
|
|
|
29
28
|
].join(",");
|
|
30
29
|
export const OBSERVER_ATTACH_WAIT_TIME = 500;
|
|
31
30
|
|
|
31
|
+
const DEFAULT_READING_TIME_LOCALE = "en-us";
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Localized "minute read" templates. `{minutes}` is replaced with the rounded
|
|
35
|
+
* reading-time value. Only displayed when reading time is greater than 1, so
|
|
36
|
+
* plural forms are always appropriate. Keys match the locales declared in
|
|
37
|
+
* sfdocs (and the doc-locale-banner) so that a localized document automatically
|
|
38
|
+
* gets a localized reading-time label.
|
|
39
|
+
*/
|
|
40
|
+
export const READING_TIME_LABELS: Record<string, string> = {
|
|
41
|
+
"en-us": "{minutes} minute read",
|
|
42
|
+
"ja-jp": "読了時間 {minutes} 分",
|
|
43
|
+
"zh-cn": "阅读时间 {minutes} 分钟",
|
|
44
|
+
"zh-tw": "閱讀時間 {minutes} 分鐘",
|
|
45
|
+
"fr-fr": "Lecture de {minutes} minutes",
|
|
46
|
+
"de-de": "{minutes} Minuten Lesezeit",
|
|
47
|
+
"it-it": "{minutes} minuti di lettura",
|
|
48
|
+
"ko-kr": "읽는 데 {minutes}분",
|
|
49
|
+
"pt-br": "{minutes} minutos de leitura",
|
|
50
|
+
"es-mx": "{minutes} minutos de lectura",
|
|
51
|
+
"es-es": "{minutes} minutos de lectura",
|
|
52
|
+
"ru-ru": "Время чтения: {minutes} мин",
|
|
53
|
+
"fi-fi": "{minutes} minuutin lukuaika",
|
|
54
|
+
"da-dk": "{minutes} minutters læsning",
|
|
55
|
+
"sv-se": "{minutes} minuters läsning",
|
|
56
|
+
"nl-nl": "{minutes} minuten leestijd",
|
|
57
|
+
"nb-no": "{minutes} minutters lesetid"
|
|
58
|
+
};
|
|
59
|
+
|
|
32
60
|
export default class ContentLayout extends LightningElement {
|
|
33
61
|
@api sidebarValue!: string;
|
|
34
62
|
@api sidebarHeader!: string;
|
|
@@ -109,17 +137,9 @@ export default class ContentLayout extends LightningElement {
|
|
|
109
137
|
);
|
|
110
138
|
}
|
|
111
139
|
|
|
112
|
-
/** Show Data Cloud sidebar only when not using old sidebar and the page has searchable results. */
|
|
113
|
-
protected get showDataCloudSidebar(): boolean {
|
|
114
|
-
return !this.useOldSidebar && this.hasDataCloudResults === true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
140
|
@track
|
|
118
141
|
protected _sidebarContent: unknown;
|
|
119
142
|
|
|
120
|
-
@track
|
|
121
|
-
protected hasDataCloudResults: boolean | null = null;
|
|
122
|
-
|
|
123
143
|
protected _breadcrumbs = null;
|
|
124
144
|
|
|
125
145
|
@track
|
|
@@ -182,6 +202,19 @@ export default class ContentLayout extends LightningElement {
|
|
|
182
202
|
return this.readingTime != null && this.readingTime > 1;
|
|
183
203
|
}
|
|
184
204
|
|
|
205
|
+
/**
|
|
206
|
+
* Localized "X minute read" string for the current document language.
|
|
207
|
+
* Falls back to the default (en-us) template when the language is missing
|
|
208
|
+
* or has no translation.
|
|
209
|
+
*/
|
|
210
|
+
get readingTimeLabel(): string {
|
|
211
|
+
const localeKey = (this.language || "").toLowerCase();
|
|
212
|
+
const template =
|
|
213
|
+
READING_TIME_LABELS[localeKey] ||
|
|
214
|
+
READING_TIME_LABELS[DEFAULT_READING_TIME_LOCALE];
|
|
215
|
+
return template.replace("{minutes}", String(this.readingTime));
|
|
216
|
+
}
|
|
217
|
+
|
|
185
218
|
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
186
219
|
get effectiveFooterOrigin(): string {
|
|
187
220
|
return (
|
|
@@ -190,11 +223,6 @@ export default class ContentLayout extends LightningElement {
|
|
|
190
223
|
}
|
|
191
224
|
|
|
192
225
|
connectedCallback(): void {
|
|
193
|
-
if (!this.useOldSidebar) {
|
|
194
|
-
fetchHasResults().then((hasResults: boolean) => {
|
|
195
|
-
this.hasDataCloudResults = hasResults;
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
226
|
const hasParentHighlightListener = closest(
|
|
199
227
|
"doc-xml-content",
|
|
200
228
|
this.template.host
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
|
|
3
|
+
interface LocaleStrings {
|
|
4
|
+
messageText: string;
|
|
5
|
+
linkUrl: string;
|
|
6
|
+
linkText: string;
|
|
7
|
+
buttonLabel: string;
|
|
8
|
+
secondaryLabel: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const DEFAULT_LOCALE = "en-us";
|
|
12
|
+
|
|
13
|
+
const LOCALE_STRINGS: Record<string, LocaleStrings> = {
|
|
14
|
+
"en-us": {
|
|
15
|
+
messageText:
|
|
16
|
+
"This text has been translated using Salesforce machine translation system. More details {link}.",
|
|
17
|
+
linkUrl:
|
|
18
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1",
|
|
19
|
+
linkText: "here",
|
|
20
|
+
buttonLabel: "Switch to English",
|
|
21
|
+
secondaryLabel: "Not Now"
|
|
22
|
+
},
|
|
23
|
+
"ja-jp": {
|
|
24
|
+
messageText:
|
|
25
|
+
"この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細は{link}をご参照ください。",
|
|
26
|
+
linkUrl:
|
|
27
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=ja",
|
|
28
|
+
linkText: "こちら",
|
|
29
|
+
buttonLabel: "英語に切り替える",
|
|
30
|
+
secondaryLabel: "今はしません"
|
|
31
|
+
},
|
|
32
|
+
"zh-cn": {
|
|
33
|
+
messageText:
|
|
34
|
+
"此文本已使用 Salesforce 机器翻译系统进行翻译。如需了解更多详情,请点击{link}。",
|
|
35
|
+
linkUrl:
|
|
36
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=zh_CN",
|
|
37
|
+
linkText: "此处",
|
|
38
|
+
buttonLabel: "切换为英语",
|
|
39
|
+
secondaryLabel: "而非现在"
|
|
40
|
+
},
|
|
41
|
+
"zh-tw": {
|
|
42
|
+
messageText:
|
|
43
|
+
"此文已使用 Salesforce 機器翻譯系統翻譯。更多詳細資料請參見{link}。",
|
|
44
|
+
linkUrl:
|
|
45
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=zh_TW",
|
|
46
|
+
linkText: "此處",
|
|
47
|
+
buttonLabel: "切換至英文",
|
|
48
|
+
secondaryLabel: "不要現在"
|
|
49
|
+
},
|
|
50
|
+
"fr-fr": {
|
|
51
|
+
messageText:
|
|
52
|
+
"Ce texte a été traduit à l’aide du système de traduction automatique de Salesforce. Plus de détails, consultez {link}.",
|
|
53
|
+
linkUrl:
|
|
54
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=fr",
|
|
55
|
+
linkText: "cette page",
|
|
56
|
+
buttonLabel: "Basculer vers la page en anglais",
|
|
57
|
+
secondaryLabel: "Pas maintenant"
|
|
58
|
+
},
|
|
59
|
+
"de-de": {
|
|
60
|
+
messageText:
|
|
61
|
+
"Dieser Text wurde mit dem maschinellen Übersetzungssystem von Salesforce übersetzt. Weitere Details finden Sie {link}.",
|
|
62
|
+
linkUrl:
|
|
63
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=de",
|
|
64
|
+
linkText: "hier",
|
|
65
|
+
buttonLabel: "Zu Englisch wechseln",
|
|
66
|
+
secondaryLabel: "Nicht jetzt"
|
|
67
|
+
},
|
|
68
|
+
"it-it": {
|
|
69
|
+
messageText:
|
|
70
|
+
"Questo testo è stato tradotto utilizzando il sistema di traduzione automatica di Salesforce. Ulteriori dettagli sono disponibili {link}.",
|
|
71
|
+
linkUrl:
|
|
72
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=it",
|
|
73
|
+
linkText: "qui",
|
|
74
|
+
buttonLabel: "Passa all'inglese",
|
|
75
|
+
secondaryLabel: "Non ora"
|
|
76
|
+
},
|
|
77
|
+
"ko-kr": {
|
|
78
|
+
messageText:
|
|
79
|
+
"본 텍스트는 Salesforce 기계 번역 시스템으로 번역되었습니다. 자세한 내용은 {link}를 참조하세요.",
|
|
80
|
+
linkUrl:
|
|
81
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=ko",
|
|
82
|
+
linkText: "여기",
|
|
83
|
+
buttonLabel: "영어로 전환",
|
|
84
|
+
secondaryLabel: "지금 안 함"
|
|
85
|
+
},
|
|
86
|
+
"pt-br": {
|
|
87
|
+
messageText:
|
|
88
|
+
"Este texto foi traduzido pelo sistema de tradução automática da Salesforce. Mais detalhes {link}.",
|
|
89
|
+
linkUrl:
|
|
90
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=pt_BR",
|
|
91
|
+
linkText: "aqui",
|
|
92
|
+
buttonLabel: "Alternar para inglês",
|
|
93
|
+
secondaryLabel: "Agora não"
|
|
94
|
+
},
|
|
95
|
+
"es-mx": {
|
|
96
|
+
messageText:
|
|
97
|
+
"Este texto se tradujo con el sistema de traducción automática de Salesforce. Obtenga más detalles {link}.",
|
|
98
|
+
linkUrl:
|
|
99
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=es_MX",
|
|
100
|
+
linkText: "aquí",
|
|
101
|
+
buttonLabel: "Cambiar a inglés",
|
|
102
|
+
secondaryLabel: "Ahora no"
|
|
103
|
+
},
|
|
104
|
+
"es-es": {
|
|
105
|
+
messageText:
|
|
106
|
+
"Este texto se ha traducido utilizando un sistema de traducción automática de Salesforce. Más información {link}.",
|
|
107
|
+
linkUrl:
|
|
108
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=es",
|
|
109
|
+
linkText: "aquí",
|
|
110
|
+
buttonLabel: "Cambiar a inglés",
|
|
111
|
+
secondaryLabel: "Ahora no"
|
|
112
|
+
},
|
|
113
|
+
"ru-ru": {
|
|
114
|
+
messageText:
|
|
115
|
+
"Данный текст был переведен при помощи системы машинного перевода Salesforce. Дополнительные сведения см. {link}.",
|
|
116
|
+
linkUrl:
|
|
117
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=ru",
|
|
118
|
+
linkText: "здесь",
|
|
119
|
+
buttonLabel: "Переключить на английский",
|
|
120
|
+
secondaryLabel: "Не сейчас"
|
|
121
|
+
},
|
|
122
|
+
"fi-fi": {
|
|
123
|
+
messageText:
|
|
124
|
+
"Tämä teksti on käännetty Salesforcen konekäännösjärjestelmän avulla. Katso lisätietoja {link}.",
|
|
125
|
+
linkUrl:
|
|
126
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=fi",
|
|
127
|
+
linkText: "täältä",
|
|
128
|
+
buttonLabel: "Vaihda englantiin",
|
|
129
|
+
secondaryLabel: "Ei nyt"
|
|
130
|
+
},
|
|
131
|
+
"da-dk": {
|
|
132
|
+
messageText:
|
|
133
|
+
"Denne tekst er oversat ved hjælp af Salesforce-maskinoversættelsessystem. Du finder flere detaljer {link}.",
|
|
134
|
+
linkUrl:
|
|
135
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=da",
|
|
136
|
+
linkText: "her",
|
|
137
|
+
buttonLabel: "Skift til engelsk",
|
|
138
|
+
secondaryLabel: "Ikke nu"
|
|
139
|
+
},
|
|
140
|
+
"sv-se": {
|
|
141
|
+
messageText:
|
|
142
|
+
"Den här texten har översatts med Salesforces maskinöversättningssystem. Mer information {link}.",
|
|
143
|
+
linkUrl:
|
|
144
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=sv",
|
|
145
|
+
linkText: "här",
|
|
146
|
+
buttonLabel: "Byt till engelska",
|
|
147
|
+
secondaryLabel: "Inte nu"
|
|
148
|
+
},
|
|
149
|
+
"nl-nl": {
|
|
150
|
+
messageText:
|
|
151
|
+
"Deze tekst werd vertaald aan de hand van het systeem voor automatische vertaling van Salesforce. U vindt {link} meer details.",
|
|
152
|
+
linkUrl:
|
|
153
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=nl_NL",
|
|
154
|
+
linkText: "hier",
|
|
155
|
+
buttonLabel: "Overschakelen op Engels",
|
|
156
|
+
secondaryLabel: "Niet nu"
|
|
157
|
+
},
|
|
158
|
+
"nb-no": {
|
|
159
|
+
messageText:
|
|
160
|
+
"Denne teksten er oversatt med Salesforce maskinoversettingssystem. Flere detaljer {link}.",
|
|
161
|
+
linkUrl:
|
|
162
|
+
"https://help.salesforce.com/s/articleView?id=000396076&type=1&language=no",
|
|
163
|
+
linkText: "her",
|
|
164
|
+
buttonLabel: "Bytt til engelsk",
|
|
165
|
+
secondaryLabel: "Ikke nå"
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default class LocaleBanner extends LightningElement {
|
|
170
|
+
@api locale = DEFAULT_LOCALE;
|
|
171
|
+
@api targetHref = "";
|
|
172
|
+
@api dismissStorageKey = "";
|
|
173
|
+
|
|
174
|
+
get localeData(): LocaleStrings {
|
|
175
|
+
return LOCALE_STRINGS[this.locale] || LOCALE_STRINGS[DEFAULT_LOCALE];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
get bannerMessage(): string {
|
|
179
|
+
const data = this.localeData;
|
|
180
|
+
const link = `<a href="${data.linkUrl}">${data.linkText}</a>`;
|
|
181
|
+
return data.messageText.replace("{link}", link);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
get bannerButtonLabel(): string {
|
|
185
|
+
return this.localeData.buttonLabel;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
get bannerButtonHref(): string {
|
|
189
|
+
return this.targetHref;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
get bannerSecondaryLabel(): string {
|
|
193
|
+
return this.localeData.secondaryLabel;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="content">
|
|
3
3
|
<dx-sidebar-old
|
|
4
|
-
lwc:if={useOldSidebar}
|
|
5
4
|
class="is-sticky left-nav-bar"
|
|
6
5
|
trees={sidebarContent}
|
|
7
6
|
value={sidebarValue}
|
|
@@ -16,16 +15,6 @@
|
|
|
16
15
|
>
|
|
17
16
|
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
18
17
|
</dx-sidebar-old>
|
|
19
|
-
<dx-sidebar
|
|
20
|
-
lwc:else
|
|
21
|
-
class="is-sticky left-nav-bar"
|
|
22
|
-
trees={sidebarContent}
|
|
23
|
-
value={sidebarValue}
|
|
24
|
-
header={sidebarHeader}
|
|
25
|
-
ontogglesidebar={onToggleSidebar}
|
|
26
|
-
>
|
|
27
|
-
<slot name="sidebar-header" slot="version-picker"></slot>
|
|
28
|
-
</dx-sidebar>
|
|
29
18
|
<div class="content-body-doc-phase-container">
|
|
30
19
|
<div class="doc-phase-wrapper">
|
|
31
20
|
<slot name="doc-phase"></slot>
|
|
@@ -52,7 +41,7 @@
|
|
|
52
41
|
></path>
|
|
53
42
|
</g>
|
|
54
43
|
</svg>
|
|
55
|
-
{
|
|
44
|
+
{readingTimeLabel}
|
|
56
45
|
</div>
|
|
57
46
|
<slot onslotchange={onSlotChange}></slot>
|
|
58
47
|
<doc-sprig-survey
|
|
@@ -68,7 +57,10 @@
|
|
|
68
57
|
</div>
|
|
69
58
|
</div>
|
|
70
59
|
<div lwc:if={showFooter} class="footer-container">
|
|
71
|
-
<dx-footer
|
|
60
|
+
<dx-footer
|
|
61
|
+
variant="no-signup"
|
|
62
|
+
mfe-config-origin={effectiveFooterOrigin}
|
|
63
|
+
></dx-footer>
|
|
72
64
|
</div>
|
|
73
65
|
</div>
|
|
74
66
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { api } from "lwc";
|
|
1
2
|
import ContentLayout from "doc/contentLayout";
|
|
2
3
|
import cx from "classnames";
|
|
3
4
|
|
|
@@ -15,6 +16,16 @@ export default class LwcContentLayout extends ContentLayout {
|
|
|
15
16
|
private allTabsCache: any[] | null = null;
|
|
16
17
|
private mainSlotCache: any = null;
|
|
17
18
|
|
|
19
|
+
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer. */
|
|
20
|
+
@api origin: string | null = null;
|
|
21
|
+
|
|
22
|
+
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
23
|
+
get effectiveFooterOrigin(): string {
|
|
24
|
+
return (
|
|
25
|
+
this.origin ?? `${window.location.origin}/developer/en-us/wp-json`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
18
29
|
private setRNBByTab() {
|
|
19
30
|
const tabPanelListItem = this.getTabPanelList();
|
|
20
31
|
this.rnbByTab = tabPanelListItem?.id === RNB_BY_TAB;
|
|
@@ -68,6 +68,16 @@ export default class RedocReference extends LightningElement {
|
|
|
68
68
|
this._parentDocPhaseInfo = value;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer. */
|
|
72
|
+
@api origin: string | null = null;
|
|
73
|
+
|
|
74
|
+
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
75
|
+
get effectiveFooterOrigin(): string {
|
|
76
|
+
return (
|
|
77
|
+
this.origin ?? `${window.location.origin}/developer/en-us/wp-json`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
71
81
|
connectedCallback(): void {
|
|
72
82
|
window.addEventListener("scroll", this.handleScrollAndResize);
|
|
73
83
|
window.addEventListener("resize", this.handleScrollAndResize);
|
|
@@ -202,7 +212,8 @@ export default class RedocReference extends LightningElement {
|
|
|
202
212
|
const currentUrl = window.location;
|
|
203
213
|
const existingParams = currentUrl.search + currentUrl.hash;
|
|
204
214
|
|
|
205
|
-
|
|
215
|
+
// Use replaceState to avoid creating a new history entry when the user visits /references without any reference ID
|
|
216
|
+
window.history.replaceState(
|
|
206
217
|
{},
|
|
207
218
|
"",
|
|
208
219
|
`${parentReferencePath}${existingParams}`
|
|
@@ -338,7 +349,10 @@ export default class RedocReference extends LightningElement {
|
|
|
338
349
|
// Appends footer component to container
|
|
339
350
|
private insertFooter(container: HTMLElement): void {
|
|
340
351
|
const footerElement = createElement("dx-footer", { is: DxFooter });
|
|
341
|
-
Object.assign(footerElement, {
|
|
352
|
+
Object.assign(footerElement, {
|
|
353
|
+
variant: "no-signup",
|
|
354
|
+
mfeConfigOrigin: this.effectiveFooterOrigin
|
|
355
|
+
});
|
|
342
356
|
container.appendChild(footerElement);
|
|
343
357
|
}
|
|
344
358
|
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
</doc-content-layout>
|
|
54
54
|
<div lwc:if={display404}>
|
|
55
55
|
<dx-error
|
|
56
|
-
image="https://
|
|
56
|
+
image="https://developer.salesforce.com/ns-assets/404.svg"
|
|
57
57
|
code="404"
|
|
58
58
|
header="Beep boop. That did not compute."
|
|
59
59
|
subtitle="The document you're looking for doesn't seem to exist."
|
|
@@ -48,6 +48,9 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
48
48
|
/** Optional origin URL for the footer MFE (e.g. wp-json endpoint). Passed through to dx-footer-mfe. */
|
|
49
49
|
@api origin: string | null = null;
|
|
50
50
|
|
|
51
|
+
/** Optional base URL for the canonical link (e.g. https://developer.salesforce.com). When set, used instead of window.location for the canonical href. */
|
|
52
|
+
@api baseUrl: string | null = null;
|
|
53
|
+
|
|
51
54
|
@api
|
|
52
55
|
get allLanguages(): Array<Language> {
|
|
53
56
|
return this._allLanguages;
|
|
@@ -251,6 +254,17 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
251
254
|
return this.pageReference.deliverable;
|
|
252
255
|
}
|
|
253
256
|
|
|
257
|
+
private get useOldSidebar(): boolean {
|
|
258
|
+
// Coveo is enabled and the version is greater than 51 (within the latest 3 versions)
|
|
259
|
+
// TODO: we need a better fix for version number check
|
|
260
|
+
return !(
|
|
261
|
+
!this.version?.releaseVersion ||
|
|
262
|
+
(this.version?.releaseVersion &&
|
|
263
|
+
parseInt(this.version.releaseVersion.replace("v", ""), 10) >=
|
|
264
|
+
53)
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
|
|
254
268
|
private get pageHeader(): Header {
|
|
255
269
|
if (!this._pageHeader) {
|
|
256
270
|
this._pageHeader = document.querySelector("doc-header")!;
|
|
@@ -308,8 +322,10 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
308
322
|
};
|
|
309
323
|
}
|
|
310
324
|
|
|
311
|
-
private handlePopState = (event: PopStateEvent): void =>
|
|
325
|
+
private handlePopState = (event: PopStateEvent): void => {
|
|
312
326
|
this.updatePageReference(this.getReferenceFromUrl(), event);
|
|
327
|
+
this.handleLocaleReload();
|
|
328
|
+
};
|
|
313
329
|
|
|
314
330
|
handleDismissVersionBanner() {
|
|
315
331
|
this.showVersionBanner = false;
|
|
@@ -584,6 +600,31 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
584
600
|
"docs",
|
|
585
601
|
this.pageReferenceToString(this.pageReference)
|
|
586
602
|
);
|
|
603
|
+
this.handleLocaleReload();
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/* This method reloads the page as locale banner context is not available in developer-website. */
|
|
607
|
+
private handleLocaleReload(): void {
|
|
608
|
+
const targetLocale = this.language?.id;
|
|
609
|
+
if (!targetLocale) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
const currentPath = window.location.pathname;
|
|
614
|
+
const localePattern = /atlas\.[a-z]{2}-[a-z]{2}\./;
|
|
615
|
+
|
|
616
|
+
if (localePattern.test(currentPath)) {
|
|
617
|
+
const newPath = currentPath.replace(
|
|
618
|
+
localePattern,
|
|
619
|
+
`atlas.${targetLocale}.`
|
|
620
|
+
);
|
|
621
|
+
const newUrl =
|
|
622
|
+
window.location.origin +
|
|
623
|
+
newPath +
|
|
624
|
+
window.location.search +
|
|
625
|
+
window.location.hash;
|
|
626
|
+
window.location.href = newUrl;
|
|
627
|
+
}
|
|
587
628
|
}
|
|
588
629
|
|
|
589
630
|
private updateHighlighting(searchParam: string): void {
|
|
@@ -755,21 +796,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
755
796
|
}
|
|
756
797
|
|
|
757
798
|
if (this.pageReference) {
|
|
758
|
-
const
|
|
799
|
+
const canonicalLink = document.querySelector(
|
|
759
800
|
'link[rel="canonical"]'
|
|
760
801
|
);
|
|
761
|
-
if (
|
|
802
|
+
if (canonicalLink) {
|
|
762
803
|
const copyPageReference = { ...this.pageReference };
|
|
763
804
|
copyPageReference.docId = copyPageReference.docId
|
|
764
805
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
765
806
|
: copyPageReference.docId;
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
this.pageReferenceToString(copyPageReference)
|
|
772
|
-
);
|
|
807
|
+
const path = this.pageReferenceToString(copyPageReference);
|
|
808
|
+
const origin = this.baseUrl
|
|
809
|
+
? this.baseUrl.replace(/\/$/, "")
|
|
810
|
+
: `${window.location.protocol}//${window.location.host}`;
|
|
811
|
+
canonicalLink.setAttribute("href", `${origin}${path}`);
|
|
773
812
|
}
|
|
774
813
|
}
|
|
775
814
|
|