@salesforcedevs/dx-components 1.3.43 → 1.3.45

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.43",
3
+ "version": "1.3.45",
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": "de82bbf2fd1ea6664ceed1233ccf4aed43ac19ec"
43
+ "gitHead": "b2340b9de4e809097ee2f5c5d1bff87b5bc3aab6"
44
44
  }
@@ -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 }));
@@ -9,7 +9,13 @@ declare module globalThis {
9
9
  let singletonScrollManagerConnected: boolean;
10
10
  }
11
11
  // mostly components shouldn't be using this, but there are a few exceptions such as amfReference
12
+
13
+ let scrollUnlocked: boolean = false;
14
+
12
15
  export const restoreScroll = () => {
16
+ if (scrollUnlocked) {
17
+ return;
18
+ }
13
19
  document.body.scrollTop = document.documentElement.scrollTop =
14
20
  window.history.state?.scroll.value;
15
21
  };
@@ -33,10 +39,10 @@ export default class ScrollManager extends LightningElement {
33
39
  */
34
40
 
35
41
  protected scrollCount = 0; // this is for dark magic, basically we lock the user out of scrolling in the first quarter second, unless they really mean it. We do this because load timings mean that the scroll can get messed up in that period
36
- protected scrollUnlocked = false;
37
42
 
38
43
  renderedCallback() {
39
- if (!globalThis.singletonScrollManagerRendered) {
44
+ scrollUnlocked = window.location.hash !== ""; // if we have anchor links, skip the entire scroll restore
45
+ if (!globalThis.singletonScrollManagerRendered && !scrollUnlocked) {
40
46
  globalThis.singletonScrollManagerRendered = true;
41
47
  if (
42
48
  window.history.state?.scroll?.docSize ===
@@ -50,10 +56,8 @@ export default class ScrollManager extends LightningElement {
50
56
  // sometimes loading is slow, so we may want to reset the scroll to
51
57
  // the correct position after loading is complete, to avoid weird behavior
52
58
  // but only if the user hasn't scrolled around in the meantime
53
- if (!this.scrollUnlocked) {
54
- restoreScroll();
55
- this.scrollUnlocked = true;
56
- }
59
+ restoreScroll();
60
+ scrollUnlocked = true;
57
61
  }, LOAD_TIME_SCROLL_RESTORE_DELAY);
58
62
  }
59
63
  } else {
@@ -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
  }
@@ -20,14 +20,6 @@ const VALID_BRANDS = [
20
20
  "success"
21
21
  ];
22
22
 
23
- export const ANALYTICS_INFO = {
24
- clickText: "Sign Up",
25
- itemTitle: "Sign Up Header Button",
26
- elementType: "button",
27
- destinationType: "internal",
28
- ctaClick: true
29
- };
30
-
31
23
  export abstract class HeaderBase extends LightningElement {
32
24
  @api bailHref?: string | null = null;
33
25
  @api bailLabel?: string | null = null;
@@ -201,9 +193,12 @@ export abstract class HeaderBase extends LightningElement {
201
193
  };
202
194
 
203
195
  private handleSignUpClick(e: PointerEvent) {
204
- track(e.currentTarget!, "custEv_signupStart", {
205
- ...ANALYTICS_INFO,
206
- clickUrl: this.signupLink
196
+ track(e.currentTarget!, "custEv_browseTrialsClick", {
197
+ clickText: "browse trials",
198
+ clickUrl: this.signupLink,
199
+ elementTitle: "dx-button",
200
+ elementType: "button",
201
+ contentCategory: "cta"
207
202
  });
208
203
  }
209
204