@salesforcedevs/dx-components 1.31.1-alpha-gh → 1.31.2
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/LICENSE +12 -0
- package/package.json +3 -2
- package/src/modules/dx/footer/footer.ts +55 -32
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.2",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -43,5 +43,6 @@
|
|
|
43
43
|
"eventsourcemock": "2.0.0",
|
|
44
44
|
"luxon": "3.4.4",
|
|
45
45
|
"msw": "^2.12.4"
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "c9d5f51d2ff55d5879b966fdfe4d2c6b49870f67"
|
|
47
48
|
}
|
|
@@ -8,7 +8,7 @@ class Footer extends LightningElement {
|
|
|
8
8
|
private _variant: FooterVariant = "small-signup";
|
|
9
9
|
private isSlotEmpty = true;
|
|
10
10
|
private signupUrl =
|
|
11
|
-
"https://www.salesforce.com/
|
|
11
|
+
"https://www.salesforce.com/company/newsletter-subscribe/?topics=Developer";
|
|
12
12
|
|
|
13
13
|
@api
|
|
14
14
|
mfeHomeHref: string = `/${window.location.host}`; // ugly hack: ideally this wouldn't be necessary, but the only way to remove the "See all ways to contact us" link from the footer MFE is to set this to a non-empty value other than "us"; and given the way that the footer works, the non-empty value needs to be something that can be appended to `/` and work correctly
|
|
@@ -151,7 +151,10 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
151
151
|
private buildFooterConfigLookupTables(config: any[]) {
|
|
152
152
|
config.forEach((item: any) => {
|
|
153
153
|
// attr_title is preferable to title because it is not language-specific
|
|
154
|
-
this.configItemTitleToItemLookup.set(
|
|
154
|
+
this.configItemTitleToItemLookup.set(
|
|
155
|
+
item.attr_title || item.title,
|
|
156
|
+
item
|
|
157
|
+
);
|
|
155
158
|
if (item.menu_item_parent) {
|
|
156
159
|
const parentId = parseInt(item.menu_item_parent, 10);
|
|
157
160
|
const children =
|
|
@@ -188,26 +191,26 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
188
191
|
return;
|
|
189
192
|
}
|
|
190
193
|
|
|
191
|
-
this.socialLinks =
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
194
|
+
this.socialLinks = socialLinksItems.map((child: any) => {
|
|
195
|
+
const childTitle: string =
|
|
196
|
+
child.attr_title || child.title || ""; // attr_title is preferable to title because it is not language-specific
|
|
197
|
+
const iconSymbol =
|
|
198
|
+
childTitle === "LinkedIn"
|
|
199
|
+
? "linked-in"
|
|
200
|
+
: childTitle.toLocaleLowerCase();
|
|
201
|
+
const iconUrlHash =
|
|
202
|
+
iconSymbol === "twitter"
|
|
203
|
+
? "#twitter-x"
|
|
204
|
+
: `#themed-${iconSymbol}`;
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
href: child.url,
|
|
208
|
+
iconSprite: "brand",
|
|
209
|
+
iconURL: `${baseSocialIconUrl}${iconUrlHash}`,
|
|
210
|
+
label: child.title,
|
|
211
|
+
iconSymbol
|
|
212
|
+
};
|
|
213
|
+
});
|
|
211
214
|
}
|
|
212
215
|
|
|
213
216
|
private setGeneralLinks() {
|
|
@@ -234,10 +237,14 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
234
237
|
|
|
235
238
|
const generalLinks: any[] = [];
|
|
236
239
|
generalLinksHeadingsItems.forEach((item: any) => {
|
|
237
|
-
const childrenItems = this.configItemParentToChildrenLookup.get(
|
|
240
|
+
const childrenItems = this.configItemParentToChildrenLookup.get(
|
|
241
|
+
item.ID
|
|
242
|
+
);
|
|
238
243
|
|
|
239
244
|
if (!childrenItems) {
|
|
240
|
-
console.error(
|
|
245
|
+
console.error(
|
|
246
|
+
`General links children items not found for item with title "${item.title}"`
|
|
247
|
+
);
|
|
241
248
|
return;
|
|
242
249
|
}
|
|
243
250
|
|
|
@@ -260,16 +267,24 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
260
267
|
}
|
|
261
268
|
|
|
262
269
|
private setLegalFooter() {
|
|
263
|
-
const copyrightNoticeItem = this.configItemTitleToItemLookup.get(
|
|
270
|
+
const copyrightNoticeItem = this.configItemTitleToItemLookup.get(
|
|
271
|
+
"All rights reserved"
|
|
272
|
+
);
|
|
264
273
|
|
|
265
274
|
if (!copyrightNoticeItem) {
|
|
266
|
-
console.error(
|
|
275
|
+
console.error(
|
|
276
|
+
"All rights reserved item not found in footer config"
|
|
277
|
+
);
|
|
267
278
|
return;
|
|
268
279
|
}
|
|
269
280
|
|
|
270
281
|
const { url, description } = copyrightNoticeItem;
|
|
271
|
-
const copyrightNoticeInnerHtml = description.replace(
|
|
272
|
-
|
|
282
|
+
const copyrightNoticeInnerHtml = description.replace(
|
|
283
|
+
"{{All rights reserved}}",
|
|
284
|
+
`<a href="${url}">All rights reserved</a>`
|
|
285
|
+
);
|
|
286
|
+
const copyrightNoticeEl =
|
|
287
|
+
this.template.querySelector(".copyright-notice")!;
|
|
273
288
|
copyrightNoticeEl.innerHTML = copyrightNoticeInnerHtml;
|
|
274
289
|
const copyrightLink = copyrightNoticeEl.querySelector("a");
|
|
275
290
|
if (copyrightLink) {
|
|
@@ -278,10 +293,14 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
278
293
|
);
|
|
279
294
|
}
|
|
280
295
|
|
|
281
|
-
const legalLinksItems = this.configItemParentToChildrenLookup.get(
|
|
296
|
+
const legalLinksItems = this.configItemParentToChildrenLookup.get(
|
|
297
|
+
copyrightNoticeItem.ID
|
|
298
|
+
);
|
|
282
299
|
|
|
283
300
|
if (!legalLinksItems) {
|
|
284
|
-
console.error(
|
|
301
|
+
console.error(
|
|
302
|
+
"Legal links children items not found in footer config"
|
|
303
|
+
);
|
|
285
304
|
return;
|
|
286
305
|
}
|
|
287
306
|
|
|
@@ -298,7 +317,8 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
298
317
|
link.href = "#";
|
|
299
318
|
link.onclick = this.handleCookiePreferencesClick;
|
|
300
319
|
} else if (itemTitle === "Your Privacy Choices") {
|
|
301
|
-
link.img =
|
|
320
|
+
link.img =
|
|
321
|
+
"https://developer.salesforce.com/ns-assets/privacyoptions.svg";
|
|
302
322
|
}
|
|
303
323
|
|
|
304
324
|
return link;
|
|
@@ -306,7 +326,10 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
|
|
|
306
326
|
}
|
|
307
327
|
|
|
308
328
|
private openOneTrustInfoDisplay() {
|
|
309
|
-
if (
|
|
329
|
+
if (
|
|
330
|
+
(window as any).OneTrust &&
|
|
331
|
+
(window as any).OneTrust.ToggleInfoDisplay
|
|
332
|
+
) {
|
|
310
333
|
(window as any).OneTrust.ToggleInfoDisplay();
|
|
311
334
|
}
|
|
312
335
|
}
|