@salesforcedevs/dx-components 1.3.50 → 1.3.51

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.3.50",
3
+ "version": "1.3.51",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
Binary file
@@ -181,11 +181,8 @@ export default class CodeBlock extends LightningElement {
181
181
  * https://github.com/storybookjs/storybook/issues/13529
182
182
  */
183
183
  async copySource(event: any) {
184
- gtmTrack(event.target, "custEv_iconClick", {
185
- clickText: this.copyBtnText,
186
- elementType: "icon",
187
- elementTitle: "dx-icon",
188
- contentCategory: "code block"
184
+ gtmTrack(event.target, "custEv_codeBlock", {
185
+ codeBlockAction: "copy"
189
186
  });
190
187
 
191
188
  try {
@@ -209,11 +206,8 @@ export default class CodeBlock extends LightningElement {
209
206
  this.theme = this.theme === DARK ? LIGHT : DARK;
210
207
  setLocalStorageData(LOCAL_STORAGE_KEY, this.theme);
211
208
 
212
- gtmTrack(event.target, "custEv_iconClick", {
213
- clickText: this.updateThemeBtnText,
214
- elementType: "icon",
215
- elementTitle: "dx-icon",
216
- contentCategory: "code block"
209
+ gtmTrack(event.target, "custEv_codeBlock", {
210
+ codeBlockAction: this.theme === DARK ? "darkmode" : "lightmode"
217
211
  });
218
212
  }
219
213
 
@@ -21,8 +21,9 @@
21
21
  >
22
22
  <template for:each={options} for:item="option" for:index="index">
23
23
  <dx-dropdown-option
24
+ suppress-gtm-nav-headings={suppressGtmNavHeadings}
24
25
  analytics-event={analyticsEvent}
25
- analytics-payload={analyticsPayload}
26
+ analytics-base-payload={analyticsBasePayload}
26
27
  active={option.active}
27
28
  key-value={option.keyValue}
28
29
  if:false={option.options}
@@ -43,8 +44,9 @@
43
44
  <span class="menu_heading">{option.label}</span>
44
45
  <template for:each={option.options} for:item="suboption">
45
46
  <dx-dropdown-option
47
+ suppress-gtm-nav-headings={suppressGTMNavHeadings}
46
48
  analytics-event={analyticsEvent}
47
- analytics-payload={analyticsPayload}
49
+ analytics-base-payload={analyticsBasePayload}
48
50
  active={suboption.active}
49
51
  key={suboption.id}
50
52
  key-value={suboption.keyValue}
@@ -38,8 +38,13 @@ export default class Dropdown extends LightningElement {
38
38
  @api variant: DropdownVariant = "base";
39
39
 
40
40
  // props forwarded to dropdown option
41
- @api analyticsEvent?: string;
42
- @api analyticsPayload?: AnalyticsPayload;
41
+ @api analyticsEvent: string | null = null;
42
+ @api analyticsBasePayload: AnalyticsPayload = {
43
+ elementType: "dropdown",
44
+ destinationType: "internal",
45
+ ctaClick: true
46
+ };
47
+ @api suppressGtmNavHeadings?: boolean = false;
43
48
 
44
49
  @api
45
50
  get options() {
@@ -9,11 +9,12 @@ import { track } from "dxUtils/analytics";
9
9
 
10
10
  export default class DropdownOption extends LightningElement {
11
11
  @api option!: OptionWithNested;
12
+ @api suppressGtmNavHeadings: boolean = false;
12
13
  @api keyValue!: string;
13
14
  @api active: boolean = false;
14
15
  @api navItemLabel: String | null = null;
15
16
  @api analyticsEvent: string | null = null;
16
- @api analyticsPayload?: AnalyticsPayload | undefined;
17
+ @api analyticsBasePayload!: AnalyticsPayload;
17
18
  @api indexPosition: number = 0;
18
19
  @api variant: DropdownVariant = "base";
19
20
 
@@ -42,16 +43,25 @@ export default class DropdownOption extends LightningElement {
42
43
  new CustomEvent("select", { detail: this.keyValue })
43
44
  );
44
45
 
45
- if (this.analyticsEvent && this.analyticsPayload && e.currentTarget) {
46
- track(e.currentTarget, this.analyticsEvent, {
47
- ...this.analyticsPayload,
48
- clickText: this.option.label,
49
- clickUrl: this.option.link?.href,
50
- elementType: this.analyticsPayload?.elementType || "dropdown",
51
- ...(this.analyticsPayload?.navType
52
- ? { navItem: this.option.label }
53
- : {})
54
- });
46
+ const payload: any = {
47
+ ...this.analyticsBasePayload,
48
+ clickText: this.keyValue || undefined,
49
+ itemTitle: this.option.label || undefined,
50
+ clickUrl: this.option.link?.href || undefined
51
+ };
52
+
53
+ const navHeading = this.navItemLabel || this.option.label || undefined;
54
+ const navSubHeading =
55
+ (this.navItemLabel ? this.option.label : undefined) || undefined;
56
+
57
+ if (!this.suppressGtmNavHeadings) {
58
+ payload.navHeading = navHeading;
59
+ payload.navSubHeading = navSubHeading;
60
+ payload.pageLocation = window.location.pathname;
61
+ }
62
+
63
+ if (this.analyticsEvent && e.currentTarget) {
64
+ track(e.currentTarget, this.analyticsEvent, payload);
55
65
  }
56
66
  }
57
67
  }
@@ -44,6 +44,11 @@ footer.signup-variant-no-signup {
44
44
  color: var(--dx-g-blue-vibrant-20);
45
45
  }
46
46
 
47
+ .term-icon {
48
+ width: 35px;
49
+ margin: 0 var(--dx-g-spacing-xs);
50
+ }
51
+
47
52
  /* TOP */
48
53
 
49
54
  .content-container_top {
@@ -402,4 +407,8 @@ footer.signup-variant-no-signup {
402
407
  .subscription dx-input {
403
408
  width: 100%;
404
409
  }
410
+
411
+ .term-icon {
412
+ margin-left: 0;
413
+ }
405
414
  }
@@ -139,6 +139,12 @@
139
139
  </template>
140
140
  <template if:false={term.onclick}>
141
141
  <a href={term.href} key={term.label} rel={term.rel}>
142
+ <img
143
+ if:true={term.img}
144
+ class="term-icon"
145
+ src={term.img}
146
+ alt="Footer Term Icon"
147
+ />
142
148
  {term.label}
143
149
  </a>
144
150
  </template>
@@ -18,6 +18,12 @@ const createNewsletterSignupHref = (email: string): string => {
18
18
  return PATH;
19
19
  };
20
20
 
21
+ const ANALYTICS_INFO = {
22
+ itemTitle: "Newsletter Sign Up Footer",
23
+ elementType: "button",
24
+ destinationType: "internal",
25
+ ctaClick: true
26
+ };
21
27
  export default class Footer extends LightningElement {
22
28
  @api locale: string | null = null;
23
29
  @api
@@ -101,11 +107,9 @@ export default class Footer extends LightningElement {
101
107
  const href = createNewsletterSignupHref(e.detail);
102
108
 
103
109
  track(e.currentTarget, "custEv_ctaButtonClick", {
110
+ ...ANALYTICS_INFO,
104
111
  clickText: this.inputSubmitLabel,
105
- clickUrl: PATH,
106
- elementType: "button",
107
- elementTitle: "dx-footer",
108
- contentCategory: "cta"
112
+ clickUrl: PATH
109
113
  });
110
114
 
111
115
  window.location.assign(href);
@@ -167,6 +167,11 @@ export const termsLinks = [
167
167
  rel: "nofollow",
168
168
  label: "Cookie Preferences",
169
169
  onclick: openOneTrustInfoDisplay
170
+ },
171
+ {
172
+ href: "https://www.salesforce.com/form/other/privacy-request/",
173
+ label: "Your Privacy Choices",
174
+ img: "/assets/svg/privacyicon.png"
170
175
  }
171
176
  ];
172
177
 
@@ -10,11 +10,10 @@ export default class FooterOption extends LightningElement {
10
10
 
11
11
  sendGtm(e: PointerEvent) {
12
12
  track(e.currentTarget, "custEv_bottomNavLinkClick", {
13
- clickText: this.label || undefined,
14
- clickUrl: this.href || undefined,
15
- navItem: this.label || undefined,
16
- elementType: "link",
17
- navType: "footer"
13
+ navHeading: this.generalLabel || undefined,
14
+ navSubHeading: this.label || undefined,
15
+ clickText: this.href || undefined,
16
+ pageLocation: window.location.pathname || undefined
18
17
  });
19
18
  }
20
19
  }
@@ -20,6 +20,12 @@ const subtitleClasses = {
20
20
  [MEDIUM]: "dx-text-heading-7"
21
21
  };
22
22
 
23
+ const ANALYTICS_INFO = {
24
+ elementType: "button",
25
+ destinationType: "internal",
26
+ ctaClick: true
27
+ };
28
+
23
29
  export default class GroupText extends LightningElement {
24
30
  @api title!: string;
25
31
  @api body?: string;
@@ -93,13 +99,13 @@ export default class GroupText extends LightningElement {
93
99
  }
94
100
 
95
101
  private trackClick(event: Event) {
96
- track(event.target!, "custEv_ctaButtonClick", {
102
+ const payload = {
103
+ ...ANALYTICS_INFO,
97
104
  clickText: event.currentTarget.innerText,
98
105
  itemTitle: event.currentTarget.innerText,
99
- clickUrl: event.currentTarget.href,
100
- elementType: "button",
101
- elementTitle: "dx-group-text",
102
- contentCategory: "cta"
103
- });
106
+ clickUrl: event.currentTarget.href
107
+ };
108
+
109
+ track(event.target!, "custEv_ctaButtonClick", payload);
104
110
  }
105
111
  }
@@ -14,7 +14,6 @@
14
14
  <!-- DESKTOP "MORE CONTENT" NAV ITEM -->
15
15
  <dx-dropdown
16
16
  analytics-event="custEv_topNavLinkClick"
17
- analytics-payload={ANALYTICS_PAYLOAD}
18
17
  if:true={navItem.options}
19
18
  nav-item-label={navItem.label}
20
19
  open-on-hover
@@ -46,10 +46,6 @@ export default class HeaderNav extends LightningElement {
46
46
  }
47
47
 
48
48
  private _navItems: OptionWithNested[] = [];
49
- private ANALYTICS_PAYLOAD = {
50
- navLevel: "2",
51
- navType: "global"
52
- };
53
49
 
54
50
  private requestOpenNavMenu(e: PointerEvent) {
55
51
  const detail = (<HTMLButtonElement>e.currentTarget).getAttribute(
@@ -24,10 +24,11 @@ export default class MainContentHeader extends LightningElement {
24
24
  if (e.currentTarget) {
25
25
  track(e.currentTarget, "custEv_ctaButtonClick", {
26
26
  clickText: this.ctaLabel,
27
+ itemTitle: this.title,
27
28
  clickUrl: this.ctaHref,
28
29
  elementType: "button",
29
- elementTitle: "dx-button",
30
- contentCategory: "cta"
30
+ destinationType: "internal",
31
+ ctaClick: true
31
32
  });
32
33
  }
33
34
  }
@@ -2,6 +2,13 @@ import classNames from "classnames";
2
2
  import { LightningElement, api } from "lwc";
3
3
  import { track } from "dxUtils/analytics";
4
4
 
5
+ const ANALYTICS_INFO = {
6
+ clickUrl: window.location.href,
7
+ ctaClick: false,
8
+ elementType: "button",
9
+ destinationType: "internal"
10
+ };
11
+
5
12
  enum PaginationClickType {
6
13
  Number,
7
14
  Next,
@@ -91,14 +98,10 @@ export default class Pagination extends LightningElement {
91
98
  ? page
92
99
  : (e.target as HTMLElement).dataset.partId;
93
100
 
94
- console.log("clickURL", e.target.href);
95
-
96
101
  track(e.currentTarget!, "custEv_pagination", {
102
+ ...ANALYTICS_INFO,
97
103
  clickText,
98
- clickUrl: window.location.href,
99
- elementType: "button",
100
- navType: "pagination",
101
- navItem: clickText
104
+ itemTitle: clickText
102
105
  });
103
106
 
104
107
  this.dispatchEvent(new CustomEvent("pagechange", { detail: page }));
@@ -32,12 +32,9 @@ export default class Tab extends LightningElement {
32
32
 
33
33
  private sendGtm(e: PointerEvent) {
34
34
  track(e.currentTarget!, "custEv_topNavLinkClick", {
35
- clickText: this.label || undefined,
36
- clickUrl: this.href || undefined,
37
- navLevel: "1",
38
- navItem: this.label || undefined,
39
- elementType: "link",
40
- navType: "global"
35
+ navHeading: this.label || undefined,
36
+ clickText: this.href || undefined,
37
+ pageLocation: window.location.pathname
41
38
  });
42
39
  }
43
40
 
@@ -146,12 +146,11 @@ export default class TreeItem extends LightningElement {
146
146
  }
147
147
 
148
148
  private sendGtm(event: Event) {
149
- track(event.currentTarget!, "custEv_leftNavLinkClick", {
149
+ track(event.currentTarget!, "custEv_leftNavClick", {
150
+ navType: "left nav bar",
150
151
  clickText: this._treeNode.label,
151
152
  clickUrl: this.href,
152
- navItem: this.parentName,
153
- navType: "left nav bar",
154
- elementType: "link"
153
+ navItem: this.parentName
155
154
  });
156
155
  }
157
156
  }