@salesforcedevs/dx-components 1.30.3 → 1.30.5

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.5",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -44,5 +44,5 @@
44
44
  "luxon": "3.4.4",
45
45
  "msw": "^2.12.4"
46
46
  },
47
- "gitHead": "13a2157444eb5b6702b9d7c56f511dc90c7614d8"
47
+ "gitHead": "6d460367150b62b690d135f6b634adb7cb2b4479"
48
48
  }
@@ -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"
@@ -267,7 +267,14 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
267
267
 
268
268
  const { url, description } = copyrightNoticeItem;
269
269
  const copyrightNoticeInnerHtml = description.replace("{{All rights reserved}}", `<a href="${url}">All rights reserved</a>`);
270
- this.template.querySelector(".copyright-notice")!.innerHTML = copyrightNoticeInnerHtml;
270
+ const copyrightNoticeEl = this.template.querySelector(".copyright-notice")!;
271
+ copyrightNoticeEl.innerHTML = copyrightNoticeInnerHtml;
272
+ const copyrightLink = copyrightNoticeEl.querySelector("a");
273
+ if (copyrightLink) {
274
+ copyrightLink.addEventListener("click", (e) =>
275
+ this.handleCopyrightLinkClick(e as Event)
276
+ );
277
+ }
271
278
 
272
279
  const legalLinksItems = this.configItemParentToChildrenLookup.get(copyrightNoticeItem.ID);
273
280
 
@@ -286,7 +293,7 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
286
293
 
287
294
  if (item.title === "Cookie Preferences") {
288
295
  link.href = "#";
289
- link.onclick = this.openOneTrustInfoDisplay;
296
+ link.onclick = this.handleCookiePreferencesClick;
290
297
  } else if (item.title === "Your Privacy Choices") {
291
298
  link.img = "https://developer.salesforce.com/ns-assets/privacyoptions.svg";
292
299
  }
@@ -300,6 +307,63 @@ function augmentWithNonMFEFooterFunctionality(FooterClass: typeof Footer) {
300
307
  (window as any).OneTrust.ToggleInfoDisplay();
301
308
  }
302
309
  }
310
+
311
+ private trackFooterLinkClick(
312
+ e: Event,
313
+ options?: {
314
+ label?: string;
315
+ elementTitle?: string;
316
+ clickUrl?: string;
317
+ }
318
+ ) {
319
+ const anchor = e.currentTarget as HTMLAnchorElement;
320
+ const clickText =
321
+ options?.label ??
322
+ anchor.textContent?.trim() ??
323
+ anchor.getAttribute("aria-label") ??
324
+ anchor.href;
325
+ const elementTitle = options?.elementTitle ?? clickText;
326
+ const clickUrl = options?.clickUrl ?? anchor.href;
327
+
328
+ track(anchor, "custEv_linkClick", {
329
+ click_text: clickText,
330
+ click_url: clickUrl,
331
+ element_type: "link",
332
+ element_title: elementTitle,
333
+ content_category: "footer",
334
+ nav_item: clickText,
335
+ nav_level: "1",
336
+ nav_type: "footer"
337
+ });
338
+ }
339
+
340
+ private handleLogoClick(e: Event) {
341
+ this.trackFooterLinkClick(e, {
342
+ label: "Salesforce",
343
+ elementTitle: "Salesforce logo",
344
+ clickUrl: `${window.location.origin}/`
345
+ });
346
+ }
347
+
348
+ private handleSocialLinkClick(e: Event) {
349
+ this.trackFooterLinkClick(e);
350
+ }
351
+
352
+ private handleCookiePreferencesClick(e: Event) {
353
+ this.trackFooterLinkClick(e, {
354
+ label: "Cookie Preferences",
355
+ clickUrl: (e.currentTarget as HTMLAnchorElement).href || "#"
356
+ });
357
+ this.openOneTrustInfoDisplay();
358
+ }
359
+
360
+ private handleTermsClick(e: Event) {
361
+ this.trackFooterLinkClick(e);
362
+ }
363
+
364
+ private handleCopyrightLinkClick(e: Event) {
365
+ this.trackFooterLinkClick(e, { label: "All rights reserved" });
366
+ }
303
367
  };
304
368
  }
305
369