@salesforcedevs/docs-components 1.28.6-alpha.1 → 1.28.6
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 -1
- package/src/modules/doc/contentLayout/contentLayout.ts +46 -0
- 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 -2
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +11 -0
- package/src/modules/doc/nav/nav.html +0 -1
- package/src/modules/doc/nav/nav.ts +0 -1
- package/src/modules/doc/redocReference/redocReference.ts +27 -7
- package/src/modules/doc/xmlContent/xmlContent.html +1 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +38 -10
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +1 -1
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.6
|
|
3
|
+
"version": "1.28.6",
|
|
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": "88933f24674487cc3903ffc7ee6738523e615df5"
|
|
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
|
+
}
|
|
@@ -28,6 +28,35 @@ const HIGHLIGHTABLE_SELECTOR = [
|
|
|
28
28
|
].join(",");
|
|
29
29
|
export const OBSERVER_ATTACH_WAIT_TIME = 500;
|
|
30
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
|
+
|
|
31
60
|
export default class ContentLayout extends LightningElement {
|
|
32
61
|
@api sidebarValue!: string;
|
|
33
62
|
@api sidebarHeader!: string;
|
|
@@ -173,6 +202,23 @@ export default class ContentLayout extends LightningElement {
|
|
|
173
202
|
return this.readingTime != null && this.readingTime > 1;
|
|
174
203
|
}
|
|
175
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. Returns an empty string when reading time is not
|
|
209
|
+
* displayed so the template stays empty in that case.
|
|
210
|
+
*/
|
|
211
|
+
get readingTimeLabel(): string {
|
|
212
|
+
if (!this.showReadingTime) {
|
|
213
|
+
return "";
|
|
214
|
+
}
|
|
215
|
+
const localeKey = (this.language || "").toLowerCase();
|
|
216
|
+
const template =
|
|
217
|
+
READING_TIME_LABELS[localeKey] ||
|
|
218
|
+
READING_TIME_LABELS[DEFAULT_READING_TIME_LOCALE];
|
|
219
|
+
return template.replace("{minutes}", String(this.readingTime));
|
|
220
|
+
}
|
|
221
|
+
|
|
176
222
|
/** When origin is provided, pass it to the footer; otherwise use dx-footer's default. */
|
|
177
223
|
get effectiveFooterOrigin(): string {
|
|
178
224
|
return (
|
|
@@ -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
|
+
}
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
></path>
|
|
42
42
|
</g>
|
|
43
43
|
</svg>
|
|
44
|
-
{
|
|
44
|
+
{readingTimeLabel}
|
|
45
45
|
</div>
|
|
46
46
|
<slot onslotchange={onSlotChange}></slot>
|
|
47
47
|
<doc-sprig-survey
|
|
@@ -57,7 +57,10 @@
|
|
|
57
57
|
</div>
|
|
58
58
|
</div>
|
|
59
59
|
<div lwc:if={showFooter} class="footer-container">
|
|
60
|
-
<dx-footer
|
|
60
|
+
<dx-footer
|
|
61
|
+
variant="no-signup"
|
|
62
|
+
mfe-config-origin={effectiveFooterOrigin}
|
|
63
|
+
></dx-footer>
|
|
61
64
|
</div>
|
|
62
65
|
</div>
|
|
63
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;
|
|
@@ -19,7 +19,6 @@ export default class Nav extends LightningElement {
|
|
|
19
19
|
@api pdfUrl!: PdfUrl;
|
|
20
20
|
@api toc!: DocToc;
|
|
21
21
|
@api pageReference!: PageReference;
|
|
22
|
-
@api enableDataCloudSearch: boolean | string = false;
|
|
23
22
|
|
|
24
23
|
handleSelected(event: CustomEvent) {
|
|
25
24
|
event.stopPropagation();
|
|
@@ -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}`
|
|
@@ -291,11 +302,7 @@ export default class RedocReference extends LightningElement {
|
|
|
291
302
|
this.insertDocPhase(apiContentDiv, docPhaseInfo);
|
|
292
303
|
}
|
|
293
304
|
|
|
294
|
-
|
|
295
|
-
this.insertSprigSurvey(apiContentDiv);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
this.insertFooter(apiContentDiv);
|
|
305
|
+
this.appendFooterItems(apiContentDiv);
|
|
299
306
|
|
|
300
307
|
// Wait for footer to be rendered before updating styles
|
|
301
308
|
requestAnimationFrame(() => {
|
|
@@ -342,7 +349,10 @@ export default class RedocReference extends LightningElement {
|
|
|
342
349
|
// Appends footer component to container
|
|
343
350
|
private insertFooter(container: HTMLElement): void {
|
|
344
351
|
const footerElement = createElement("dx-footer", { is: DxFooter });
|
|
345
|
-
Object.assign(footerElement, {
|
|
352
|
+
Object.assign(footerElement, {
|
|
353
|
+
variant: "no-signup",
|
|
354
|
+
mfeConfigOrigin: this.effectiveFooterOrigin
|
|
355
|
+
});
|
|
346
356
|
container.appendChild(footerElement);
|
|
347
357
|
}
|
|
348
358
|
|
|
@@ -358,6 +368,16 @@ export default class RedocReference extends LightningElement {
|
|
|
358
368
|
wrapper.appendChild(feedbackElement);
|
|
359
369
|
}
|
|
360
370
|
|
|
371
|
+
private appendFooterItems(parent: HTMLElement): void {
|
|
372
|
+
const container = document.createElement("div");
|
|
373
|
+
container.className = "appended-footer-container";
|
|
374
|
+
if (typeof Sprig !== "undefined") {
|
|
375
|
+
this.insertSprigSurvey(container);
|
|
376
|
+
}
|
|
377
|
+
this.insertFooter(container);
|
|
378
|
+
parent.appendChild(container);
|
|
379
|
+
}
|
|
380
|
+
|
|
361
381
|
// Adjusts third column bottom position to prevent footer overlap
|
|
362
382
|
private updateRedocThirdColumnStyle(redocContainer: HTMLElement): void {
|
|
363
383
|
const footer = redocContainer.querySelector(
|
|
@@ -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;
|
|
@@ -319,8 +322,10 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
319
322
|
};
|
|
320
323
|
}
|
|
321
324
|
|
|
322
|
-
private handlePopState = (event: PopStateEvent): void =>
|
|
325
|
+
private handlePopState = (event: PopStateEvent): void => {
|
|
323
326
|
this.updatePageReference(this.getReferenceFromUrl(), event);
|
|
327
|
+
this.handleLocaleReload();
|
|
328
|
+
};
|
|
324
329
|
|
|
325
330
|
handleDismissVersionBanner() {
|
|
326
331
|
this.showVersionBanner = false;
|
|
@@ -595,6 +600,31 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
595
600
|
"docs",
|
|
596
601
|
this.pageReferenceToString(this.pageReference)
|
|
597
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
|
+
}
|
|
598
628
|
}
|
|
599
629
|
|
|
600
630
|
private updateHighlighting(searchParam: string): void {
|
|
@@ -766,21 +796,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
766
796
|
}
|
|
767
797
|
|
|
768
798
|
if (this.pageReference) {
|
|
769
|
-
const
|
|
799
|
+
const canonicalLink = document.querySelector(
|
|
770
800
|
'link[rel="canonical"]'
|
|
771
801
|
);
|
|
772
|
-
if (
|
|
802
|
+
if (canonicalLink) {
|
|
773
803
|
const copyPageReference = { ...this.pageReference };
|
|
774
804
|
copyPageReference.docId = copyPageReference.docId
|
|
775
805
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
776
806
|
: copyPageReference.docId;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
this.pageReferenceToString(copyPageReference)
|
|
783
|
-
);
|
|
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}`);
|
|
784
812
|
}
|
|
785
813
|
}
|
|
786
814
|
|