@salesforcedevs/docs-components 0.56.2 → 0.57.0

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/docs-components",
3
- "version": "0.56.2",
3
+ "version": "0.57.0",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -24,5 +24,5 @@
24
24
  "@types/lodash.orderby": "^4.6.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "47b838f7aa4fb0c55349f98074753103b693851f"
27
+ "gitHead": "ec519d645639c13fab52eb62663930901f66b2fe"
28
28
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
2
  <dx-icon if:true={isBackArrowVariant} symbol="back"></dx-icon>
3
- <a if:true={href} href={href}>{label}</a>
3
+ <a if:true={href} href={href} onclick={onLinkClick}>{label}</a>
4
4
  <span if:false={href}>{label}</span>
5
5
  </template>
@@ -1,5 +1,6 @@
1
+ import { track } from "dxUtils/analytics";
1
2
  import { LightningElement, api } from "lwc";
2
- import { BreadcrumbItemVariant } from "typings/custom";
3
+ import { AnalyticsPayload, BreadcrumbItemVariant } from "typings/custom";
3
4
 
4
5
  const BREADCRUMB_LONG = "breadcrumb_long";
5
6
  const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
@@ -7,6 +8,8 @@ const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
7
8
  const LONG_LABEL_NUMBER = 30;
8
9
  export default class BreadcrumbItem extends LightningElement {
9
10
  @api href?: string;
11
+ @api analyticsEvent!: string;
12
+ @api analyticsBasePayload!: AnalyticsPayload;
10
13
 
11
14
  @api
12
15
  get label() {
@@ -46,4 +49,17 @@ export default class BreadcrumbItem extends LightningElement {
46
49
  private get isBackArrowVariant(): boolean {
47
50
  return this._variant === "back-arrow";
48
51
  }
52
+
53
+ private onLinkClick(event: Event): void {
54
+ if (!this.analyticsEvent) {
55
+ return;
56
+ }
57
+
58
+ track(event.target!, this.analyticsEvent, {
59
+ ...this.analyticsBasePayload,
60
+ clickText: this.label,
61
+ itemTitle: this.label,
62
+ pageLocation: window.location.pathname
63
+ });
64
+ }
49
65
  }
@@ -9,7 +9,6 @@
9
9
  nav {
10
10
  display: flex;
11
11
  align-items: center;
12
- height: 100%;
13
12
  position: relative;
14
13
  gap: var(--dx-g-spacing-sm);
15
14
  }
@@ -17,3 +16,10 @@ nav {
17
16
  .breadcrumb-item_slash {
18
17
  min-width: fit-content;
19
18
  }
19
+
20
+ dx-dropdown {
21
+ --dx-c-dropdown-option-font-size: var(--dx-g-text-sm);
22
+ --dx-c-dropdown-option-label-color: var(
23
+ --dx-c-breadcrumbs-breadcrumb-color
24
+ );
25
+ }
@@ -3,6 +3,8 @@
3
3
  <template if:false={renderSmallVariant}>
4
4
  <template if:true={renderFirstCrumb}>
5
5
  <doc-breadcrumb-item
6
+ analytics-event={analyticsEventName}
7
+ analytics-base-payload={analyticsBasePayload}
6
8
  href={firstCrumb.href}
7
9
  label={firstCrumb.label}
8
10
  ></doc-breadcrumb-item>
@@ -11,10 +13,14 @@
11
13
  <template if:true={renderDropdown}>
12
14
  <dx-dropdown
13
15
  if:true={renderDropdown}
16
+ analytics-event={analyticsEventName}
17
+ analytics-base-payload={analyticsBasePayload}
14
18
  options={dropdownOptions}
15
19
  open-on-hover
16
20
  placement="bottom"
17
- width="200px"
21
+ suppress-gtm-nav-headings
22
+ variant="indented"
23
+ width="fit-content"
18
24
  >
19
25
  <dx-button
20
26
  aria-label="Open Breadcrumbs Dropdown"
@@ -27,6 +33,8 @@
27
33
  </template>
28
34
  <template for:each={breadcrumbItems} for:item="breadcrumb">
29
35
  <doc-breadcrumb-item
36
+ analytics-event={analyticsEventName}
37
+ analytics-base-payload={analyticsBasePayload}
30
38
  href={breadcrumb.href}
31
39
  key={breadcrumb.label}
32
40
  label={breadcrumb.label}
@@ -39,6 +47,8 @@
39
47
  </template>
40
48
  <template if:true={renderSmallVariant}>
41
49
  <doc-breadcrumb-item
50
+ analytics-event={analyticsEventName}
51
+ analytics-base-payload={analyticsBasePayload}
42
52
  href={lastLinkCrump.href}
43
53
  label={lastLinkCrump.label}
44
54
  variant="back-arrow"
@@ -15,6 +15,13 @@ const CONSTANTS = {
15
15
  dropdownWidth: 32
16
16
  };
17
17
 
18
+ export const ANALYTICS_EVENT_NAME = "custEv_breadcrumbClick";
19
+ export const ANALYTICS_BASE_PAYLOAD = {
20
+ elementType: "breadcrumb",
21
+ locationOnPage: "breadcrumb",
22
+ ctaClick: true
23
+ };
24
+
18
25
  export default class Breadcrumbs extends LightningElement {
19
26
  @api ariaLabel: string = "Documentation Breadcrumbs";
20
27
 
@@ -84,6 +91,14 @@ export default class Breadcrumbs extends LightningElement {
84
91
  return this.breadcrumbs[this.breadcrumbs.length - 1];
85
92
  }
86
93
 
94
+ private get analyticsEventName() {
95
+ return ANALYTICS_EVENT_NAME;
96
+ }
97
+
98
+ private get analyticsBasePayload() {
99
+ return ANALYTICS_BASE_PAYLOAD;
100
+ }
101
+
87
102
  renderedCallback(): void {
88
103
  if (!this.observer) {
89
104
  this.observer = new ResizeObserver((entries) => {