@salesforcedevs/dx-components 1.30.3 → 1.30.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.30.3",
3
+ "version": "1.30.6",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -43,6 +43,5 @@
43
43
  "eventsourcemock": "2.0.0",
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
- },
47
- "gitHead": "13a2157444eb5b6702b9d7c56f511dc90c7614d8"
46
+ }
48
47
  }
@@ -54,7 +54,7 @@
54
54
  lwc:if={showContainerMiddle}
55
55
  class="content-container content-container_middle"
56
56
  >
57
- <a class="logo" href="/">
57
+ <a class="logo" href="/" onclick={handleLogoClick}>
58
58
  <img
59
59
  src="https://developer.salesforce.com/ns-assets/salesforce-logo-corporate.svg"
60
60
  alt="Salesforce logo"
@@ -69,6 +69,7 @@
69
69
  class={link.iconSymbol}
70
70
  target="_blank"
71
71
  rel="noopener"
72
+ onclick={handleSocialLinkClick}
72
73
  >
73
74
  <svg
74
75
  xmlns="http://www.w3.org/2000/svg"
@@ -107,13 +108,18 @@
107
108
  href={term.href}
108
109
  key={term.label}
109
110
  rel={term.rel}
110
- onclick={term.onclick}
111
+ onclick={handleCookiePreferencesClick}
111
112
  >
112
113
  {term.label}
113
114
  </a>
114
115
  </template>
115
116
  <template lwc:else>
116
- <a href={term.href} key={term.label} rel={term.rel}>
117
+ <a
118
+ href={term.href}
119
+ key={term.label}
120
+ rel={term.rel}
121
+ onclick={handleTermsClick}
122
+ >
117
123
  <img
118
124
  lwc:if={term.img}
119
125
  class="term-icon"
@@ -150,7 +150,8 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
150
150
 
151
151
  private buildFooterConfigLookupTables(config: any[]) {
152
152
  config.forEach((item: any) => {
153
- this.configItemTitleToItemLookup.set(item.title, item);
153
+ // attr_title is preferable to title because it is not language-specific
154
+ this.configItemTitleToItemLookup.set(item.attr_title || item.title, item);
154
155
  if (item.menu_item_parent) {
155
156
  const parentId = parseInt(item.menu_item_parent, 10);
156
157
  const children =
@@ -189,10 +190,11 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
189
190
 
190
191
  this.socialLinks =
191
192
  socialLinksItems.map((child: any) => {
193
+ const childTitle: string = child.attr_title || child.title || ""; // attr_title is preferable to title because it is not language-specific
192
194
  const iconSymbol =
193
- child.title === "LinkedIn"
195
+ childTitle === "LinkedIn"
194
196
  ? "linked-in"
195
- : child.title.toLowerCase();
197
+ : childTitle.toLocaleLowerCase();
196
198
  const iconUrlHash =
197
199
  iconSymbol === "twitter"
198
200
  ? "#twitter-x"
@@ -267,7 +269,14 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
267
269
 
268
270
  const { url, description } = copyrightNoticeItem;
269
271
  const copyrightNoticeInnerHtml = description.replace("{{All rights reserved}}", `<a href="${url}">All rights reserved</a>`);
270
- this.template.querySelector(".copyright-notice")!.innerHTML = copyrightNoticeInnerHtml;
272
+ const copyrightNoticeEl = this.template.querySelector(".copyright-notice")!;
273
+ copyrightNoticeEl.innerHTML = copyrightNoticeInnerHtml;
274
+ const copyrightLink = copyrightNoticeEl.querySelector("a");
275
+ if (copyrightLink) {
276
+ copyrightLink.addEventListener("click", (e) =>
277
+ this.handleCopyrightLinkClick(e as Event)
278
+ );
279
+ }
271
280
 
272
281
  const legalLinksItems = this.configItemParentToChildrenLookup.get(copyrightNoticeItem.ID);
273
282
 
@@ -284,10 +293,11 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
284
293
  rel: item.rel
285
294
  };
286
295
 
287
- if (item.title === "Cookie Preferences") {
296
+ const itemTitle: string = item.attr_title || item.title || ""; // attr_title is preferable to title because it is not language-specific
297
+ if (itemTitle === "Cookie Preferences") {
288
298
  link.href = "#";
289
- link.onclick = this.openOneTrustInfoDisplay;
290
- } else if (item.title === "Your Privacy Choices") {
299
+ link.onclick = this.handleCookiePreferencesClick;
300
+ } else if (itemTitle === "Your Privacy Choices") {
291
301
  link.img = "https://developer.salesforce.com/ns-assets/privacyoptions.svg";
292
302
  }
293
303
 
@@ -300,6 +310,63 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
300
310
  (window as any).OneTrust.ToggleInfoDisplay();
301
311
  }
302
312
  }
313
+
314
+ private trackFooterLinkClick(
315
+ e: Event,
316
+ options?: {
317
+ label?: string;
318
+ elementTitle?: string;
319
+ clickUrl?: string;
320
+ }
321
+ ) {
322
+ const anchor = e.currentTarget as HTMLAnchorElement;
323
+ const clickText =
324
+ options?.label ??
325
+ anchor.textContent?.trim() ??
326
+ anchor.getAttribute("aria-label") ??
327
+ anchor.href;
328
+ const elementTitle = options?.elementTitle ?? clickText;
329
+ const clickUrl = options?.clickUrl ?? anchor.href;
330
+
331
+ track(anchor, "custEv_linkClick", {
332
+ click_text: clickText,
333
+ click_url: clickUrl,
334
+ element_type: "link",
335
+ element_title: elementTitle,
336
+ content_category: "footer",
337
+ nav_item: clickText,
338
+ nav_level: "1",
339
+ nav_type: "footer"
340
+ });
341
+ }
342
+
343
+ private handleLogoClick(e: Event) {
344
+ this.trackFooterLinkClick(e, {
345
+ label: "Salesforce",
346
+ elementTitle: "Salesforce logo",
347
+ clickUrl: `${window.location.origin}/`
348
+ });
349
+ }
350
+
351
+ private handleSocialLinkClick(e: Event) {
352
+ this.trackFooterLinkClick(e);
353
+ }
354
+
355
+ private handleCookiePreferencesClick(e: Event) {
356
+ this.trackFooterLinkClick(e, {
357
+ label: "Cookie Preferences",
358
+ clickUrl: (e.currentTarget as HTMLAnchorElement).href || "#"
359
+ });
360
+ this.openOneTrustInfoDisplay();
361
+ }
362
+
363
+ private handleTermsClick(e: Event) {
364
+ this.trackFooterLinkClick(e);
365
+ }
366
+
367
+ private handleCopyrightLinkClick(e: Event) {
368
+ this.trackFooterLinkClick(e, { label: "All rights reserved" });
369
+ }
303
370
  };
304
371
  }
305
372
 
package/LICENSE DELETED
@@ -1,12 +0,0 @@
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.