@salesforcedevs/dx-components 1.3.44 → 1.3.46

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.44",
3
+ "version": "1.3.46",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -40,5 +40,5 @@
40
40
  "eventsourcemock": "^2.0.0",
41
41
  "luxon": "^3.1.0"
42
42
  },
43
- "gitHead": "6fd47c4a90b3238225555542a33e2f10246cbc5b"
43
+ "gitHead": "decc9a3791a30eb8d16fb7cffb3adf7092ab863b"
44
44
  }
@@ -1,6 +1,7 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import cx from "classnames";
3
3
  import { toJson } from "dxUtils/normalizers";
4
+ import { track } from "dxUtils/analytics";
4
5
 
5
6
  export default class CardTrial extends LightningElement {
6
7
  @api badgeBackgroundColor?: string = "indigo-vibrant-90";
@@ -97,13 +98,26 @@ export default class CardTrial extends LightningElement {
97
98
  this._modalOpen = !this._modalOpen;
98
99
  }
99
100
 
100
- private handleClick() {
101
+ private handleClick(e: PointerEvent) {
101
102
  // card is clickable only if it doesn't contain buttons (for accessibility reasons)
102
103
  if (!this.hasButtons) {
103
104
  window.location.assign(this.href);
105
+ if (this.href.includes("signup")) {
106
+ this.handleSignUpClick(e);
107
+ }
104
108
  }
105
109
  }
106
110
 
111
+ private handleSignUpClick(e: PointerEvent) {
112
+ track(e.currentTarget!, "custEv_signupStart", {
113
+ click_text: this.label,
114
+ element_title: this.title,
115
+ element_type: "card",
116
+ click_url: this.href,
117
+ content_category: "cta"
118
+ });
119
+ }
120
+
107
121
  private isExternalURL(url: string | undefined): boolean {
108
122
  if (!url) {
109
123
  return false;
@@ -31,6 +31,7 @@
31
31
  class="button-cta"
32
32
  size="large"
33
33
  href={href}
34
+ onclick={handleSignUpClick}
34
35
  variant="primary"
35
36
  font="sans"
36
37
  icon-symbol={buttonIcon}
@@ -1,5 +1,6 @@
1
1
  import { LightningElement, api } from "lwc";
2
2
  import { toJson } from "dxUtils/normalizers";
3
+ import { track } from "dxUtils/analytics";
3
4
 
4
5
  export default class CardTrial extends LightningElement {
5
6
  @api badgeBackgroundColor?: string = "indigo-vibrant-90";
@@ -64,4 +65,16 @@ export default class CardTrial extends LightningElement {
64
65
  private handleModalClose() {
65
66
  this.dispatchEvent(new CustomEvent("togglemodal"));
66
67
  }
68
+
69
+ private handleSignUpClick(e: PointerEvent) {
70
+ if (this.href.includes("signup")) {
71
+ track(e.currentTarget!, "custEv_signupStart", {
72
+ click_text: this.buttonCta,
73
+ element_title: this.title,
74
+ element_type: "card",
75
+ click_url: this.href,
76
+ content_category: "cta"
77
+ });
78
+ }
79
+ }
67
80
  }
@@ -181,8 +181,11 @@ 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_codeBlock", {
185
- codeBlockAction: "copy"
184
+ gtmTrack(event.target, "custEv_iconClick", {
185
+ clickText: this.copyBtnText,
186
+ elementType: "icon",
187
+ elementTitle: "dx-icon",
188
+ contentCategory: "code block"
186
189
  });
187
190
 
188
191
  try {
@@ -206,8 +209,11 @@ export default class CodeBlock extends LightningElement {
206
209
  this.theme = this.theme === DARK ? LIGHT : DARK;
207
210
  setLocalStorageData(LOCAL_STORAGE_KEY, this.theme);
208
211
 
209
- gtmTrack(event.target, "custEv_codeBlock", {
210
- codeBlockAction: this.theme === DARK ? "darkmode" : "lightmode"
212
+ gtmTrack(event.target, "custEv_iconClick", {
213
+ clickText: this.updateThemeBtnText,
214
+ elementType: "icon",
215
+ elementTitle: "dx-icon",
216
+ contentCategory: "code block"
211
217
  });
212
218
  }
213
219
 
@@ -21,9 +21,8 @@
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}
25
24
  analytics-event={analyticsEvent}
26
- analytics-base-payload={analyticsBasePayload}
25
+ analytics-payload={analyticsPayload}
27
26
  active={option.active}
28
27
  key-value={option.keyValue}
29
28
  if:false={option.options}
@@ -44,9 +43,8 @@
44
43
  <span class="menu_heading">{option.label}</span>
45
44
  <template for:each={option.options} for:item="suboption">
46
45
  <dx-dropdown-option
47
- suppress-gtm-nav-headings={suppressGTMNavHeadings}
48
46
  analytics-event={analyticsEvent}
49
- analytics-base-payload={analyticsBasePayload}
47
+ analytics-payload={analyticsPayload}
50
48
  active={suboption.active}
51
49
  key={suboption.id}
52
50
  key-value={suboption.keyValue}
@@ -38,13 +38,8 @@ 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 | null = null;
42
- @api analyticsBasePayload: AnalyticsPayload = {
43
- elementType: "dropdown",
44
- destinationType: "internal",
45
- ctaClick: true
46
- };
47
- @api suppressGtmNavHeadings?: boolean = false;
41
+ @api analyticsEvent?: string;
42
+ @api analyticsPayload?: AnalyticsPayload;
48
43
 
49
44
  @api
50
45
  get options() {
@@ -9,12 +9,11 @@ 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;
13
12
  @api keyValue!: string;
14
13
  @api active: boolean = false;
15
14
  @api navItemLabel: String | null = null;
16
15
  @api analyticsEvent: string | null = null;
17
- @api analyticsBasePayload!: AnalyticsPayload;
16
+ @api analyticsPayload?: AnalyticsPayload | undefined;
18
17
  @api indexPosition: number = 0;
19
18
  @api variant: DropdownVariant = "base";
20
19
 
@@ -43,25 +42,16 @@ export default class DropdownOption extends LightningElement {
43
42
  new CustomEvent("select", { detail: this.keyValue })
44
43
  );
45
44
 
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);
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
+ });
65
55
  }
66
56
  }
67
57
  }
@@ -18,12 +18,6 @@ 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
- };
27
21
  export default class Footer extends LightningElement {
28
22
  @api locale: string | null = null;
29
23
  @api
@@ -107,9 +101,11 @@ export default class Footer extends LightningElement {
107
101
  const href = createNewsletterSignupHref(e.detail);
108
102
 
109
103
  track(e.currentTarget, "custEv_ctaButtonClick", {
110
- ...ANALYTICS_INFO,
111
104
  clickText: this.inputSubmitLabel,
112
- clickUrl: PATH
105
+ clickUrl: PATH,
106
+ elementType: "button",
107
+ elementTitle: "dx-footer",
108
+ contentCategory: "cta"
113
109
  });
114
110
 
115
111
  window.location.assign(href);
@@ -10,10 +10,11 @@ export default class FooterOption extends LightningElement {
10
10
 
11
11
  sendGtm(e: PointerEvent) {
12
12
  track(e.currentTarget, "custEv_bottomNavLinkClick", {
13
- navHeading: this.generalLabel || undefined,
14
- navSubHeading: this.label || undefined,
15
- clickText: this.href || undefined,
16
- pageLocation: window.location.pathname || undefined
13
+ clickText: this.label || undefined,
14
+ clickUrl: this.href || undefined,
15
+ navItem: this.label || undefined,
16
+ elementType: "link",
17
+ navType: "footer"
17
18
  });
18
19
  }
19
20
  }
@@ -20,12 +20,6 @@ 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
-
29
23
  export default class GroupText extends LightningElement {
30
24
  @api title!: string;
31
25
  @api body?: string;
@@ -99,13 +93,13 @@ export default class GroupText extends LightningElement {
99
93
  }
100
94
 
101
95
  private trackClick(event: Event) {
102
- const payload = {
103
- ...ANALYTICS_INFO,
96
+ track(event.target!, "custEv_ctaButtonClick", {
104
97
  clickText: event.currentTarget.innerText,
105
98
  itemTitle: event.currentTarget.innerText,
106
- clickUrl: event.currentTarget.href
107
- };
108
-
109
- track(event.target!, "custEv_ctaButtonClick", payload);
99
+ clickUrl: event.currentTarget.href,
100
+ elementType: "button",
101
+ elementTitle: "dx-group-text",
102
+ contentCategory: "cta"
103
+ });
110
104
  }
111
105
  }
@@ -14,6 +14,7 @@
14
14
  <!-- DESKTOP "MORE CONTENT" NAV ITEM -->
15
15
  <dx-dropdown
16
16
  analytics-event="custEv_topNavLinkClick"
17
+ analytics-payload={ANALYTICS_PAYLOAD}
17
18
  if:true={navItem.options}
18
19
  nav-item-label={navItem.label}
19
20
  open-on-hover
@@ -46,6 +46,10 @@ 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
+ };
49
53
 
50
54
  private requestOpenNavMenu(e: PointerEvent) {
51
55
  const detail = (<HTMLButtonElement>e.currentTarget).getAttribute(
@@ -24,11 +24,10 @@ 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,
28
27
  clickUrl: this.ctaHref,
29
28
  elementType: "button",
30
- destinationType: "internal",
31
- ctaClick: true
29
+ elementTitle: "dx-button",
30
+ contentCategory: "cta"
32
31
  });
33
32
  }
34
33
  }
@@ -2,13 +2,6 @@ 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
-
12
5
  enum PaginationClickType {
13
6
  Number,
14
7
  Next,
@@ -98,10 +91,14 @@ export default class Pagination extends LightningElement {
98
91
  ? page
99
92
  : (e.target as HTMLElement).dataset.partId;
100
93
 
94
+ console.log("clickURL", e.target.href);
95
+
101
96
  track(e.currentTarget!, "custEv_pagination", {
102
- ...ANALYTICS_INFO,
103
97
  clickText,
104
- itemTitle: clickText
98
+ clickUrl: window.location.href,
99
+ elementType: "button",
100
+ navType: "pagination",
101
+ navItem: clickText
105
102
  });
106
103
 
107
104
  this.dispatchEvent(new CustomEvent("pagechange", { detail: page }));
@@ -32,9 +32,12 @@ export default class Tab extends LightningElement {
32
32
 
33
33
  private sendGtm(e: PointerEvent) {
34
34
  track(e.currentTarget!, "custEv_topNavLinkClick", {
35
- navHeading: this.label || undefined,
36
- clickText: this.href || undefined,
37
- pageLocation: window.location.pathname
35
+ clickText: this.label || undefined,
36
+ clickUrl: this.href || undefined,
37
+ navLevel: "1",
38
+ navItem: this.label || undefined,
39
+ elementType: "link",
40
+ navType: "global"
38
41
  });
39
42
  }
40
43
 
@@ -146,11 +146,12 @@ export default class TreeItem extends LightningElement {
146
146
  }
147
147
 
148
148
  private sendGtm(event: Event) {
149
- track(event.currentTarget!, "custEv_leftNavClick", {
150
- navType: "left nav bar",
149
+ track(event.currentTarget!, "custEv_leftNavLinkClick", {
151
150
  clickText: this._treeNode.label,
152
151
  clickUrl: this.href,
153
- navItem: this.parentName
152
+ navItem: this.parentName,
153
+ navType: "left nav bar",
154
+ elementType: "link"
154
155
  });
155
156
  }
156
157
  }
@@ -21,11 +21,11 @@ const VALID_BRANDS = [
21
21
  ];
22
22
 
23
23
  export const ANALYTICS_INFO = {
24
- clickText: "Sign Up",
25
- itemTitle: "Sign Up Header Button",
24
+ click_text: "Sign Up",
25
+ element_title: "Sign Up Header Button",
26
26
  elementType: "button",
27
- destinationType: "internal",
28
- ctaClick: true
27
+ element_type: "internal",
28
+ content_category: "cta"
29
29
  };
30
30
 
31
31
  export abstract class HeaderBase extends LightningElement {
@@ -201,9 +201,9 @@ export abstract class HeaderBase extends LightningElement {
201
201
  };
202
202
 
203
203
  private handleSignUpClick(e: PointerEvent) {
204
- track(e.currentTarget!, "custEv_signupStart", {
204
+ track(e.currentTarget!, "custEv_browseTrialsClick", {
205
205
  ...ANALYTICS_INFO,
206
- clickUrl: this.signupLink
206
+ click_url: this.signupLink
207
207
  });
208
208
  }
209
209