@salesforcedevs/docs-components 1.3.49-mulesoft-lwc-2 → 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 +1 -1
- package/src/modules/doc/amfReference/amfReference.html +3 -7
- package/src/modules/doc/amfReference/amfReference.ts +1 -1
- package/src/modules/doc/amfTopic/amfTopic.ts +42 -12
- package/src/modules/doc/breadcrumbItem/breadcrumbItem.ts +10 -8
- package/src/modules/doc/breadcrumbs/breadcrumbs.html +9 -3
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +16 -12
- package/src/modules/doc/xmlContent/xmlContent.html +2 -2
- package/src/modules/doc/xmlContent/xmlContent.ts +1 -7
package/package.json
CHANGED
|
@@ -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}
|
|
@@ -36,14 +37,9 @@
|
|
|
36
37
|
<slot></slot>
|
|
37
38
|
</template>
|
|
38
39
|
<template if:true={showSpecBasedReference}>
|
|
39
|
-
<div class="container"
|
|
40
|
+
<div class="container">
|
|
40
41
|
<div class="api-documentation">
|
|
41
|
-
<
|
|
42
|
-
amf={topicModel.amf}
|
|
43
|
-
selected={topicModel.id}
|
|
44
|
-
selected-type={topicModel.type}
|
|
45
|
-
no-try-it
|
|
46
|
-
></arc-api-documentation>
|
|
42
|
+
<doc-amf-topic model={topicModel}></doc-amf-topic>
|
|
47
43
|
</div>
|
|
48
44
|
</div>
|
|
49
45
|
</template>
|
|
@@ -175,7 +175,7 @@ export default class AmfReference extends LightningElement {
|
|
|
175
175
|
|
|
176
176
|
connectedCallback(): void {
|
|
177
177
|
this.addEventListener(
|
|
178
|
-
"
|
|
178
|
+
"api-navigation-selection-changed",
|
|
179
179
|
this._boundOnApiNavigationChanged
|
|
180
180
|
);
|
|
181
181
|
window.addEventListener(
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
+
import {
|
|
3
|
+
createDocumentationElement,
|
|
4
|
+
createEndpointElement,
|
|
5
|
+
createMethodElement,
|
|
6
|
+
createSecurityElement,
|
|
7
|
+
createSummaryElement,
|
|
8
|
+
createTypeElement
|
|
9
|
+
} from "./utils";
|
|
2
10
|
import type { TopicModel } from "./types";
|
|
3
11
|
|
|
4
12
|
export default class AmfTopic extends LightningElement {
|
|
@@ -35,21 +43,43 @@ export default class AmfTopic extends LightningElement {
|
|
|
35
43
|
update(): void {
|
|
36
44
|
const container = this.template.querySelector("div.topic-container");
|
|
37
45
|
const { id } = this.model;
|
|
46
|
+
const type = this.type;
|
|
47
|
+
const amf = this.amf;
|
|
48
|
+
const { parser } = this.model;
|
|
49
|
+
let element;
|
|
38
50
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
if (type === "summary") {
|
|
52
|
+
element = createSummaryElement(amf);
|
|
53
|
+
} else if (type === "endpoint") {
|
|
54
|
+
const endpointModel = parser.computeEndpointApiModel(amf, id);
|
|
55
|
+
element = createEndpointElement(amf, endpointModel, id);
|
|
56
|
+
} else if (type === "method") {
|
|
57
|
+
const endpointMethodModel = parser.computeEndpointApiMethodModel(
|
|
58
|
+
amf,
|
|
59
|
+
id
|
|
60
|
+
);
|
|
61
|
+
const methodModel = parser.computeMethodApiModel(amf, id);
|
|
62
|
+
element = createMethodElement(
|
|
63
|
+
amf,
|
|
64
|
+
endpointMethodModel,
|
|
65
|
+
methodModel
|
|
66
|
+
);
|
|
67
|
+
} else if (type === "security") {
|
|
68
|
+
const securityModel = parser.computeSecurityApiModel(amf, id);
|
|
69
|
+
element = createSecurityElement(amf, securityModel);
|
|
70
|
+
} else if (type === "type") {
|
|
71
|
+
const mediaTypes = parser.computeApiMediaTypes(amf);
|
|
72
|
+
const typeModel = parser.computeTypeApiModel(amf, id);
|
|
73
|
+
element = createTypeElement(amf, typeModel, mediaTypes);
|
|
74
|
+
} else if (type === "documentation") {
|
|
75
|
+
const docsModel = parser.computeDocsApiModel(amf, id);
|
|
76
|
+
element = createDocumentationElement(amf, docsModel);
|
|
77
|
+
}
|
|
46
78
|
|
|
47
|
-
if (container) {
|
|
48
|
-
|
|
49
|
-
container.firstChild.remove();
|
|
50
|
-
}
|
|
51
|
-
container.appendChild(element);
|
|
79
|
+
if (container.firstChild) {
|
|
80
|
+
container.firstChild.remove();
|
|
52
81
|
}
|
|
82
|
+
container.appendChild(element);
|
|
53
83
|
}
|
|
54
84
|
}
|
|
55
85
|
|
|
@@ -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
|
|
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
|
-
|
|
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
|
-
|
|
101
|
-
|
|
105
|
+
private get analyticsEventName() {
|
|
106
|
+
return ANALYTICS_EVENT_NAME;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private get analyticsBasePayload() {
|
|
102
110
|
return {
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
18
|
-
analytics-
|
|
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
|
|