@salesforcedevs/docs-components 1.3.49 → 1.3.50

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": "1.3.49",
3
+ "version": "1.3.50",
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": "13454336d298fe5fad2971fd82e0da5760af2d85"
27
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
28
  }
@@ -22,6 +22,7 @@
22
22
  <div slot="sidebar-header" class="version-picker">
23
23
  <template if:true={isVersionEnabled}>
24
24
  <dx-dropdown
25
+ suppress-gtm-nav-headings
25
26
  onchange={handleVersionChange}
26
27
  data-type="version"
27
28
  options={versions}
@@ -1,6 +1,6 @@
1
1
  import { track } from "dxUtils/analytics";
2
2
  import { LightningElement, api } from "lwc";
3
- import { BreadcrumbItemVariant } from "typings/custom";
3
+ import { AnalyticsPayload, BreadcrumbItemVariant } from "typings/custom";
4
4
 
5
5
  const BREADCRUMB_LONG = "breadcrumb_long";
6
6
  const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
@@ -8,7 +8,8 @@ const BREADCRUMB_BACK_ARROW = "breadcrumb_back-arrow";
8
8
  const LONG_LABEL_NUMBER = 30;
9
9
  export default class BreadcrumbItem extends LightningElement {
10
10
  @api href?: string;
11
- @api level?: string;
11
+ @api analyticsEvent!: string;
12
+ @api analyticsBasePayload!: AnalyticsPayload;
12
13
 
13
14
  @api
14
15
  get label() {
@@ -50,13 +51,14 @@ export default class BreadcrumbItem extends LightningElement {
50
51
  }
51
52
 
52
53
  private onLinkClick(event: Event): void {
53
- track(event.target!, "custEv_breadcrumbClick", {
54
+ if (!this.analyticsEvent) {
55
+ return;
56
+ }
57
+
58
+ track(event.target!, this.analyticsEvent, {
59
+ ...this.analyticsBasePayload,
54
60
  clickText: this.label,
55
- clickUrl: this.href,
56
- elementType: "link",
57
- navType: "breadcrumb",
58
- navLevel: this.level ? this.level + 1 : 1,
59
- navItem: this.label
61
+ clickUrl: this.href
60
62
  });
61
63
  }
62
64
  }
@@ -3,18 +3,21 @@
3
3
  <template if:true={displayCrumbs}>
4
4
  <template if:false={renderSmallVariant}>
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>
9
11
  <span class="breadcrumb-item_slash">/</span>
10
12
  <template if:true={renderDropdown}>
11
13
  <dx-dropdown
12
- analytics-event="custEv_breadcrumbClick"
13
- analytics-payload={ANALYTICS_PAYLOAD}
14
14
  if:true={renderDropdown}
15
+ analytics-event={analyticsEventName}
16
+ analytics-base-payload={analyticsBasePayload}
15
17
  options={dropdownOptions}
16
18
  open-on-hover
17
19
  placement="bottom"
20
+ suppress-gtm-nav-headings
18
21
  variant="indented"
19
22
  width="fit-content"
20
23
  >
@@ -29,10 +32,11 @@
29
32
  </template>
30
33
  <template for:each={breadcrumbItems} for:item="breadcrumb">
31
34
  <doc-breadcrumb-item
35
+ analytics-event={analyticsEventName}
36
+ analytics-base-payload={analyticsBasePayload}
32
37
  href={breadcrumb.href}
33
38
  key={breadcrumb.id}
34
39
  label={breadcrumb.label}
35
- level={breadcrumb.level}
36
40
  ></doc-breadcrumb-item>
37
41
  <span class="breadcrumb-item_slash" key={breadcrumb.label}>
38
42
  /
@@ -44,6 +48,8 @@
44
48
  </template>
45
49
  <template if:true={renderSmallVariant}>
46
50
  <doc-breadcrumb-item
51
+ analytics-event={analyticsEventName}
52
+ analytics-base-payload={analyticsBasePayload}
47
53
  href={lastLinkCrump.href}
48
54
  label={lastLinkCrump.label}
49
55
  variant="back-arrow"
@@ -17,6 +17,11 @@ const CONSTANTS = {
17
17
  dropdownWidth: 32
18
18
  };
19
19
 
20
+ export const ANALYTICS_EVENT_NAME = "custEv_breadcrumbNavClick";
21
+ export const ANALYTICS_BASE_PAYLOAD = {
22
+ navType: "breadcrumb"
23
+ };
24
+
20
25
  export default class Breadcrumbs extends LightningElement {
21
26
  @api ariaLabel: string = "Documentation Breadcrumbs";
22
27
 
@@ -97,12 +102,14 @@ export default class Breadcrumbs extends LightningElement {
97
102
  return this.breadcrumbs[this.breadcrumbs.length - 1];
98
103
  }
99
104
 
100
- // this payload is only used for breadcrumb dropdown
101
- private get ANALYTICS_PAYLOAD() {
105
+ private get analyticsEventName() {
106
+ return ANALYTICS_EVENT_NAME;
107
+ }
108
+
109
+ private get analyticsBasePayload() {
102
110
  return {
103
- elementType: "link",
104
- navType: "breadcrumb",
105
- navLevel: 1
111
+ ...ANALYTICS_BASE_PAYLOAD,
112
+ navItem: this.breadcrumbs.map((crumb) => crumb.label).join("/")
106
113
  };
107
114
  }
108
115
 
@@ -130,13 +137,10 @@ export default class Breadcrumbs extends LightningElement {
130
137
  return;
131
138
  }
132
139
 
133
- this._breadcrumbs = toJson(breadcrumbs).map(
134
- (crumb: Breadcrumb, index: number) => ({
135
- ...crumb,
136
- id: crumb.id || crumb.href,
137
- level: index
138
- })
139
- );
140
+ this._breadcrumbs = toJson(breadcrumbs).map((crumb: Breadcrumb) => ({
141
+ ...crumb,
142
+ id: crumb.id || crumb.href
143
+ }));
140
144
  }
141
145
 
142
146
  private updateDropdownOptionAmount(): void {
@@ -14,8 +14,8 @@
14
14
  <div slot="sidebar-header" class="document-pickers">
15
15
  <dx-dropdown
16
16
  data-type="version"
17
- analytics-event="custEv_ctaLinkClick"
18
- analytics-payload={ANALYTICS_PAYLOAD}
17
+ suppress-gtm-nav-headings
18
+ analytics-event={analyticsEvent}
19
19
  options={versionOptions}
20
20
  value={version.id}
21
21
  width="290px"
@@ -63,6 +63,7 @@ export default class DocXmlContent extends LightningElementWithState<{
63
63
  private sidebarContent: Array<TreeNode> = null;
64
64
  private version: DocVersion = null;
65
65
  private docTitle = "";
66
+ private analyticsEvent = "custEv_ctaLinkClick";
66
67
  private _pathName = "";
67
68
  private _pageHeader?: Header;
68
69
  private listenerAttached = false;
@@ -280,13 +281,6 @@ export default class DocXmlContent extends LightningElementWithState<{
280
281
  );
281
282
  }
282
283
 
283
- private get ANALYTICS_PAYLOAD() {
284
- return {
285
- elementTitle: "version picker",
286
- contentCategory: "cta"
287
- };
288
- }
289
-
290
284
  private handlePopState = (): void =>
291
285
  this.updatePageReference(this.getReferenceFromUrl());
292
286
 
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.