@salesforcedevs/docs-components 1.27.22-banner → 1.27.22-banner-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/package.json +2 -2
- package/src/modules/doc/banner/banner.css +181 -83
- package/src/modules/doc/banner/banner.html +70 -64
- package/src/modules/doc/banner/banner.ts +65 -6
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.html +4 -1
- package/src/modules/doc/lwcContentLayout/lwcContentLayout.ts +11 -0
- package/src/modules/doc/redocReference/redocReference.ts +11 -1
- package/src/modules/doc/xmlContent/xmlContent.ts +10 -9
- package/src/modules/docHelpers/contentLayoutStyle/contentLayoutStyle.css +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.27.22-banner",
|
|
3
|
+
"version": "1.27.22-banner-6",
|
|
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": "7c2d0518bbabd8ad478bcbca57641b8e7982363a"
|
|
29
29
|
}
|
|
@@ -2,134 +2,232 @@
|
|
|
2
2
|
@import "dxHelpers/text";
|
|
3
3
|
|
|
4
4
|
:host {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
--doc-banner-padding-x-left:
|
|
8
|
-
--doc-banner-padding-x-right:
|
|
9
|
-
--doc-banner-icon-size:
|
|
10
|
-
--doc-banner-
|
|
11
|
-
--doc-banner-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
display: block;
|
|
6
|
+
|
|
7
|
+
--doc-banner-padding-x-left: var(--dx-g-spacing-2xl);
|
|
8
|
+
--doc-banner-padding-x-right: var(--dx-g-spacing-lg);
|
|
9
|
+
--doc-banner-info-icon-outer-size: var(--dx-g-icon-size-lg-b);
|
|
10
|
+
--doc-banner-info-icon-size: var(--dx-g-icon-size-lg);
|
|
11
|
+
--doc-banner-bar-min-height: calc(
|
|
12
|
+
var(--dx-g-spacing-3xl) - var(--dx-g-spacing-xs)
|
|
13
|
+
);
|
|
14
|
+
--doc-banner-close-wrap-width: calc(
|
|
15
|
+
var(--doc-banner-bar-min-height) + var(--dx-g-spacing-xs)
|
|
16
|
+
);
|
|
17
|
+
--doc-banner-icon-frame-width: calc(
|
|
18
|
+
var(--doc-banner-padding-x-left) +
|
|
19
|
+
var(--doc-banner-info-icon-outer-size) + var(--dx-g-spacing-sm)
|
|
20
|
+
);
|
|
21
|
+
--doc-banner-close-color: var(--dx-g-gray-50);
|
|
22
|
+
--doc-banner-text-vertical-padding: calc(
|
|
23
|
+
(var(--dx-g-spacing-xs) + var(--dx-g-spacing-sm)) / 2
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host > div {
|
|
17
28
|
display: flex;
|
|
18
|
-
align-items:
|
|
29
|
+
align-items: flex-start;
|
|
19
30
|
justify-content: space-between;
|
|
20
31
|
width: 100%;
|
|
21
|
-
|
|
22
|
-
height: var(--doc-banner-height);
|
|
23
|
-
padding
|
|
24
|
-
|
|
25
|
-
background: var(--
|
|
32
|
+
margin: 0;
|
|
33
|
+
min-height: var(--doc-banner-bar-min-height);
|
|
34
|
+
padding: 0 var(--doc-banner-padding-x-right) 0
|
|
35
|
+
var(--doc-banner-padding-x-left);
|
|
36
|
+
background: var(--dx-g-gray-90);
|
|
26
37
|
box-sizing: border-box;
|
|
27
38
|
}
|
|
28
39
|
|
|
29
|
-
.
|
|
30
|
-
.
|
|
31
|
-
.
|
|
40
|
+
.icon-wrap,
|
|
41
|
+
.main,
|
|
42
|
+
.content,
|
|
43
|
+
.actions,
|
|
44
|
+
.close-wrap {
|
|
32
45
|
display: flex;
|
|
33
46
|
align-items: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.icon-wrap,
|
|
50
|
+
.close-wrap {
|
|
34
51
|
flex-shrink: 0;
|
|
35
52
|
}
|
|
36
53
|
|
|
37
|
-
.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
.main {
|
|
55
|
+
flex: 1 1 0;
|
|
56
|
+
min-width: 0;
|
|
57
|
+
align-self: flex-start;
|
|
58
|
+
padding: var(--doc-banner-text-vertical-padding) 0;
|
|
59
|
+
gap: var(--dx-g-spacing-md);
|
|
60
|
+
flex-wrap: wrap;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.icon-wrap {
|
|
64
|
+
width: calc(
|
|
65
|
+
var(--doc-banner-info-icon-outer-size) + var(--dx-g-spacing-sm)
|
|
66
|
+
);
|
|
67
|
+
min-height: var(--dx-g-spacing-xl);
|
|
68
|
+
align-self: flex-start;
|
|
69
|
+
justify-content: flex-start;
|
|
70
|
+
align-items: flex-start;
|
|
41
71
|
}
|
|
42
72
|
|
|
43
|
-
.
|
|
44
|
-
--dx-c-icon-size: var(--doc-banner-icon-size);
|
|
73
|
+
.icon-wrap dx-icon {
|
|
74
|
+
--dx-c-icon-size: var(--doc-banner-info-icon-size);
|
|
45
75
|
|
|
46
|
-
width: var(--doc-banner-icon-size);
|
|
47
|
-
height: var(--doc-banner-icon-size);
|
|
76
|
+
width: var(--doc-banner-info-icon-size);
|
|
77
|
+
height: var(--doc-banner-info-icon-size);
|
|
78
|
+
margin: calc(var(--dx-g-spacing-sm) + var(--dx-g-spacing-xs))
|
|
79
|
+
var(--dx-g-spacing-sm) 0 0;
|
|
48
80
|
}
|
|
49
81
|
|
|
50
|
-
.
|
|
51
|
-
flex: 1;
|
|
82
|
+
.content {
|
|
83
|
+
flex: 0 1 auto;
|
|
52
84
|
min-width: 0;
|
|
53
|
-
max-width:
|
|
54
|
-
height: var(--
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
align-items: center;
|
|
58
|
-
box-sizing: border-box;
|
|
85
|
+
max-width: 100%;
|
|
86
|
+
min-height: var(--dx-g-spacing-xl);
|
|
87
|
+
align-items: flex-start;
|
|
88
|
+
gap: var(--dx-g-spacing-sm);
|
|
59
89
|
}
|
|
60
90
|
|
|
61
|
-
.
|
|
91
|
+
.message {
|
|
62
92
|
margin: 0;
|
|
63
|
-
|
|
93
|
+
padding: var(--doc-banner-text-vertical-padding) 0;
|
|
94
|
+
font-size: var(--dx-g-text-sm);
|
|
95
|
+
font-weight: var(--dx-g-font-normal);
|
|
96
|
+
line-height: var(--doc-banner-info-icon-size);
|
|
97
|
+
color: var(--dx-g-gray-30);
|
|
64
98
|
}
|
|
65
99
|
|
|
66
|
-
.
|
|
100
|
+
.message a {
|
|
67
101
|
color: var(--dx-g-cloud-blue-vibrant-50);
|
|
68
102
|
text-decoration: underline;
|
|
69
103
|
}
|
|
70
104
|
|
|
71
|
-
.
|
|
105
|
+
.message a:hover {
|
|
72
106
|
opacity: 0.9;
|
|
73
107
|
}
|
|
74
108
|
|
|
75
|
-
.
|
|
76
|
-
|
|
77
|
-
height:
|
|
78
|
-
gap: var(--dx-g-spacing-
|
|
109
|
+
.actions {
|
|
110
|
+
flex-shrink: 0;
|
|
111
|
+
min-height: var(--dx-g-spacing-xl);
|
|
112
|
+
gap: var(--dx-g-spacing-smd);
|
|
113
|
+
flex-wrap: wrap;
|
|
79
114
|
}
|
|
80
115
|
|
|
81
|
-
.
|
|
82
|
-
--dx-c-button-primary-color: var(--
|
|
83
|
-
--dx-c-button-primary-color-hover: var(--
|
|
116
|
+
.primary-btn {
|
|
117
|
+
--dx-c-button-primary-color: var(--dx-g-cloud-blue-vibrant-50);
|
|
118
|
+
--dx-c-button-primary-color-hover: var(--dx-g-cloud-blue-vibrant-40);
|
|
84
119
|
--dx-c-button-vertical-spacing: 0;
|
|
85
120
|
--dx-c-button-horizontal-spacing: var(--dx-g-spacing-md);
|
|
86
121
|
|
|
87
|
-
min-width:
|
|
88
|
-
|
|
89
|
-
|
|
122
|
+
min-width: min(
|
|
123
|
+
calc(var(--dx-g-spacing-5xl) + var(--dx-g-spacing-3xl)),
|
|
124
|
+
100%
|
|
125
|
+
);
|
|
126
|
+
height: var(--dx-g-spacing-xl);
|
|
127
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
90
128
|
}
|
|
91
129
|
|
|
92
|
-
.
|
|
93
|
-
min-width:
|
|
130
|
+
.primary-btn::part(container) {
|
|
131
|
+
min-width: min(
|
|
132
|
+
calc(var(--dx-g-spacing-5xl) + var(--dx-g-spacing-3xl)),
|
|
133
|
+
100%
|
|
134
|
+
);
|
|
94
135
|
width: 100%;
|
|
95
|
-
height:
|
|
136
|
+
height: var(--dx-g-spacing-xl);
|
|
96
137
|
padding: 0 var(--dx-g-spacing-md);
|
|
97
|
-
border-radius:
|
|
98
|
-
box-sizing: border-box;
|
|
138
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
99
139
|
}
|
|
100
140
|
|
|
101
|
-
.
|
|
141
|
+
.close-wrap {
|
|
142
|
+
align-self: flex-start;
|
|
102
143
|
justify-content: center;
|
|
103
|
-
|
|
104
|
-
|
|
144
|
+
align-items: center;
|
|
145
|
+
width: var(--doc-banner-close-wrap-width);
|
|
146
|
+
height: var(--doc-banner-bar-min-height);
|
|
147
|
+
padding: var(--dx-g-spacing-smd) var(--dx-g-spacing-sm)
|
|
148
|
+
var(--dx-g-spacing-md);
|
|
149
|
+
margin-left: auto;
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
cursor: pointer;
|
|
105
152
|
}
|
|
106
153
|
|
|
107
|
-
.
|
|
154
|
+
.close-wrap .close-btn {
|
|
155
|
+
width: 100%;
|
|
156
|
+
height: 100%;
|
|
108
157
|
display: flex;
|
|
109
158
|
align-items: center;
|
|
110
159
|
justify-content: center;
|
|
111
|
-
|
|
112
|
-
height: 100%;
|
|
113
|
-
padding: 2.9px;
|
|
114
|
-
margin: 0;
|
|
115
|
-
color: var(--doc-banner-close-color);
|
|
116
|
-
background: none;
|
|
117
|
-
border: none;
|
|
118
|
-
cursor: pointer;
|
|
119
|
-
border-radius: 0;
|
|
160
|
+
pointer-events: none;
|
|
120
161
|
box-sizing: border-box;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
162
|
+
padding: 2.9038px 0 0 2.9038px;
|
|
163
|
+
|
|
164
|
+
--dx-c-icon-size: var(--dx-g-icon-size-sm);
|
|
165
|
+
--dx-c-button-custom-color: var(--doc-banner-close-color);
|
|
166
|
+
--dx-c-button-custom-color-hover: var(--doc-banner-close-color);
|
|
167
|
+
--dx-c-button-custom-background: transparent;
|
|
168
|
+
--dx-c-button-custom-background-hover: rgb(0 0 0 / 5%);
|
|
169
|
+
--dx-c-button-custom-border: 1px solid transparent;
|
|
170
|
+
--dx-c-button-custom-border-hover: 1px solid transparent;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@media (max-width: 1279px) {
|
|
174
|
+
:host {
|
|
175
|
+
--doc-banner-padding-x-left: var(--dx-g-spacing-xl);
|
|
176
|
+
--doc-banner-padding-x-right: var(--dx-g-spacing-md);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
:host > div {
|
|
180
|
+
position: relative;
|
|
181
|
+
max-width: 100%;
|
|
182
|
+
min-height: calc(
|
|
183
|
+
var(--doc-banner-bar-min-height) + var(--dx-g-spacing-xl)
|
|
184
|
+
);
|
|
185
|
+
flex-wrap: wrap;
|
|
186
|
+
align-content: space-between;
|
|
187
|
+
padding: 0 var(--doc-banner-padding-x-right) 0 0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.icon-wrap {
|
|
191
|
+
position: absolute;
|
|
192
|
+
left: 0;
|
|
193
|
+
top: 0;
|
|
194
|
+
bottom: 0;
|
|
195
|
+
width: var(--doc-banner-icon-frame-width);
|
|
196
|
+
min-height: 0;
|
|
197
|
+
padding: 0 0 0 var(--doc-banner-padding-x-left);
|
|
198
|
+
order: 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.main {
|
|
202
|
+
order: 1;
|
|
203
|
+
flex-wrap: wrap;
|
|
204
|
+
margin-left: var(--doc-banner-icon-frame-width);
|
|
205
|
+
gap: var(--dx-g-spacing-2xs);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.content {
|
|
209
|
+
order: 0;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.close-wrap {
|
|
213
|
+
order: 2;
|
|
214
|
+
min-height: var(--doc-banner-bar-min-height);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.actions {
|
|
218
|
+
order: 1;
|
|
219
|
+
flex: 0 0 100%;
|
|
220
|
+
width: 100%;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@media (max-width: 768px) {
|
|
225
|
+
:host {
|
|
226
|
+
--doc-banner-padding-x-left: var(--dx-g-spacing-lg);
|
|
227
|
+
--doc-banner-padding-x-right: var(--dx-g-spacing-sm);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
:host > div {
|
|
231
|
+
min-height: var(--doc-banner-bar-min-height);
|
|
232
|
+
}
|
|
135
233
|
}
|
|
@@ -1,70 +1,76 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<div class="
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
{
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
2
|
+
<template lwc:if={showBanner}>
|
|
3
|
+
<div class="doc-notification-bar" part="container">
|
|
4
|
+
<div class="icon-wrap" part="icon-wrap">
|
|
5
|
+
<dx-icon
|
|
6
|
+
symbol="info"
|
|
7
|
+
size="override"
|
|
8
|
+
part="icon"
|
|
9
|
+
color={iconColor}
|
|
10
|
+
></dx-icon>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="main" part="main">
|
|
13
|
+
<div class="content" part="content">
|
|
14
|
+
<p class="message dx-text-body-4" part="message">
|
|
15
|
+
<template lwc:if={messageText}>{messageText}</template>
|
|
16
|
+
<template lwc:if={hasMessageLink}>
|
|
17
|
+
<a
|
|
18
|
+
href={messageLinkUrl}
|
|
19
|
+
target="_blank"
|
|
20
|
+
rel="noopener noreferrer"
|
|
21
|
+
part="message-link"
|
|
22
|
+
>
|
|
23
|
+
{messageLinkText}
|
|
24
|
+
</a>
|
|
25
|
+
</template>
|
|
26
|
+
</p>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="actions" part="actions">
|
|
29
|
+
<template lwc:if={hasPrimaryButton}>
|
|
30
|
+
<dx-button
|
|
31
|
+
class="primary-btn"
|
|
32
|
+
href={buttonHref}
|
|
33
|
+
variant="primary"
|
|
34
|
+
size="small"
|
|
35
|
+
part="button"
|
|
36
|
+
>
|
|
37
|
+
{buttonLabel}
|
|
38
|
+
</dx-button>
|
|
39
|
+
</template>
|
|
40
|
+
<template lwc:if={hasSecondaryAction}>
|
|
41
|
+
<dx-button
|
|
42
|
+
class="secondary-btn"
|
|
43
|
+
variant="inline"
|
|
44
|
+
onclick={handleSecondaryClick}
|
|
45
|
+
part="secondary"
|
|
46
|
+
>
|
|
47
|
+
{secondaryLabel}
|
|
48
|
+
</dx-button>
|
|
49
|
+
</template>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
<template lwc:if={showCloseButton}>
|
|
53
|
+
<div
|
|
54
|
+
class="close-wrap"
|
|
55
|
+
part="close-wrap"
|
|
56
|
+
role="button"
|
|
57
|
+
tabindex="0"
|
|
49
58
|
aria-label="Close"
|
|
50
59
|
onclick={handleCloseClick}
|
|
60
|
+
onkeydown={handleCloseKeydown}
|
|
51
61
|
>
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
<dx-button
|
|
63
|
+
class="close-btn"
|
|
64
|
+
variant="icon-only"
|
|
65
|
+
icon-symbol="close"
|
|
66
|
+
icon-size="override"
|
|
67
|
+
icon-color={iconColor}
|
|
58
68
|
aria-hidden="true"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
</button>
|
|
67
|
-
</div>
|
|
68
|
-
</template>
|
|
69
|
-
</div>
|
|
69
|
+
tabindex="-1"
|
|
70
|
+
part="close"
|
|
71
|
+
></dx-button>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
70
76
|
</template>
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
import { LightningElement, api } from "lwc";
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
2
|
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
3
3
|
|
|
4
|
+
const LOCALE_BANNER_STORAGE_PREFIX = "dsc-doc-locale-banner-dismissed-";
|
|
5
|
+
|
|
6
|
+
const DEFAULT_MESSAGE_TEXT = "This page was machine-translated ";
|
|
7
|
+
const DEFAULT_BUTTON_LABEL = "Switch to English";
|
|
8
|
+
|
|
4
9
|
export default class Banner extends LightningElement {
|
|
5
|
-
@api messageText =
|
|
10
|
+
@api messageText = DEFAULT_MESSAGE_TEXT;
|
|
6
11
|
|
|
7
12
|
@api messageLinkUrl = "";
|
|
8
13
|
|
|
9
14
|
@api messageLinkText = "here";
|
|
10
15
|
|
|
11
|
-
@api buttonLabel =
|
|
16
|
+
@api buttonLabel = DEFAULT_BUTTON_LABEL;
|
|
12
17
|
|
|
13
18
|
@api buttonHref = "";
|
|
14
19
|
|
|
15
20
|
@api secondaryLabel = "";
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
@api dismissStorageKey = "";
|
|
23
|
+
|
|
24
|
+
_showCloseButton = true;
|
|
18
25
|
|
|
19
26
|
@api
|
|
20
27
|
get showCloseButton(): boolean {
|
|
@@ -24,6 +31,25 @@ export default class Banner extends LightningElement {
|
|
|
24
31
|
this._showCloseButton = normalizeBoolean(value);
|
|
25
32
|
}
|
|
26
33
|
|
|
34
|
+
@track private _dismissed = false;
|
|
35
|
+
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
if (
|
|
38
|
+
this.dismissStorageKey &&
|
|
39
|
+
typeof window !== "undefined" &&
|
|
40
|
+
window.sessionStorage
|
|
41
|
+
) {
|
|
42
|
+
this._dismissed =
|
|
43
|
+
window.sessionStorage.getItem(
|
|
44
|
+
`${LOCALE_BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`
|
|
45
|
+
) === "true";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get showBanner(): boolean {
|
|
50
|
+
return !this._dismissed;
|
|
51
|
+
}
|
|
52
|
+
|
|
27
53
|
get hasMessageLink(): boolean {
|
|
28
54
|
return !!this.messageLinkUrl;
|
|
29
55
|
}
|
|
@@ -36,15 +62,48 @@ export default class Banner extends LightningElement {
|
|
|
36
62
|
return !!this.secondaryLabel;
|
|
37
63
|
}
|
|
38
64
|
|
|
65
|
+
get iconColor(): string {
|
|
66
|
+
return "gray-50";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
persistDismissAndHide() {
|
|
70
|
+
if (
|
|
71
|
+
this.dismissStorageKey &&
|
|
72
|
+
typeof window !== "undefined" &&
|
|
73
|
+
window.sessionStorage
|
|
74
|
+
) {
|
|
75
|
+
window.sessionStorage.setItem(
|
|
76
|
+
`${LOCALE_BANNER_STORAGE_PREFIX}${this.dismissStorageKey}`,
|
|
77
|
+
"true"
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
this._dismissed = true;
|
|
81
|
+
}
|
|
82
|
+
|
|
39
83
|
handleSecondaryClick() {
|
|
84
|
+
this.persistDismissAndHide();
|
|
40
85
|
this.dispatchEvent(
|
|
41
|
-
new CustomEvent("
|
|
86
|
+
new CustomEvent("dismissLocaleBanner", {
|
|
87
|
+
bubbles: true,
|
|
88
|
+
composed: true
|
|
89
|
+
})
|
|
42
90
|
);
|
|
43
91
|
}
|
|
44
92
|
|
|
45
93
|
handleCloseClick() {
|
|
94
|
+
this.persistDismissAndHide();
|
|
46
95
|
this.dispatchEvent(
|
|
47
|
-
new CustomEvent("
|
|
96
|
+
new CustomEvent("dismissLocaleBanner", {
|
|
97
|
+
bubbles: true,
|
|
98
|
+
composed: true
|
|
99
|
+
})
|
|
48
100
|
);
|
|
49
101
|
}
|
|
102
|
+
|
|
103
|
+
handleCloseKeydown(event: KeyboardEvent) {
|
|
104
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
this.handleCloseClick();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
50
109
|
}
|
|
@@ -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);
|
|
@@ -338,7 +348,7 @@ export default class RedocReference extends LightningElement {
|
|
|
338
348
|
// Appends footer component to container
|
|
339
349
|
private insertFooter(container: HTMLElement): void {
|
|
340
350
|
const footerElement = createElement("dx-footer", { is: DxFooter });
|
|
341
|
-
Object.assign(footerElement, { variant: "no-signup" });
|
|
351
|
+
Object.assign(footerElement, { variant: "no-signup", mfeConfigOrigin: this.effectiveFooterOrigin });
|
|
342
352
|
container.appendChild(footerElement);
|
|
343
353
|
}
|
|
344
354
|
|
|
@@ -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;
|
|
@@ -766,21 +769,19 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
766
769
|
}
|
|
767
770
|
|
|
768
771
|
if (this.pageReference) {
|
|
769
|
-
const
|
|
772
|
+
const canonicalLink = document.querySelector(
|
|
770
773
|
'link[rel="canonical"]'
|
|
771
774
|
);
|
|
772
|
-
if (
|
|
775
|
+
if (canonicalLink) {
|
|
773
776
|
const copyPageReference = { ...this.pageReference };
|
|
774
777
|
copyPageReference.docId = copyPageReference.docId
|
|
775
778
|
? this.dropVersionFromDocId(copyPageReference.docId)
|
|
776
779
|
: copyPageReference.docId;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
this.pageReferenceToString(copyPageReference)
|
|
783
|
-
);
|
|
780
|
+
const path = this.pageReferenceToString(copyPageReference);
|
|
781
|
+
const origin = this.baseUrl
|
|
782
|
+
? this.baseUrl.replace(/\/$/, "")
|
|
783
|
+
: `${window.location.protocol}//${window.location.host}`;
|
|
784
|
+
canonicalLink.setAttribute("href", `${origin}${path}`);
|
|
784
785
|
}
|
|
785
786
|
}
|
|
786
787
|
|