@salesforcedevs/dx-components 1.3.206-alpha.12 → 1.3.206-alpha.14
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
|
@@ -43,12 +43,12 @@ const resultsTemplatesInnerHtml = `
|
|
|
43
43
|
class="result-template"
|
|
44
44
|
type="text/html"
|
|
45
45
|
data-field-publicurl=""
|
|
46
|
+
data-condition="raw.breadcrumbs"
|
|
46
47
|
>
|
|
47
48
|
<div class="dx-result">
|
|
48
49
|
<div class="dx-result-info">
|
|
49
50
|
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
50
51
|
<span class="CoveoFieldValue" data-field="@breadcrumbs" data-helper="breadcrumbs" data-html-value="true"></span>
|
|
51
|
-
<span class="CoveoFieldValue" data-field="@uri" data-helper="uriBreadcrumbs" data-html-value="true"></span>
|
|
52
52
|
</div>
|
|
53
53
|
<p class="dx-result-title">
|
|
54
54
|
<a
|
|
@@ -63,11 +63,49 @@ const resultsTemplatesInnerHtml = `
|
|
|
63
63
|
id="myDefaultResultTemplate"
|
|
64
64
|
class="result-template"
|
|
65
65
|
type="text/html"
|
|
66
|
+
data-condition="raw.breadcrumbs"
|
|
66
67
|
>
|
|
67
68
|
<div class="dx-result">
|
|
68
69
|
<div class="dx-result-info">
|
|
69
70
|
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
70
71
|
<span class="CoveoFieldValue" data-field="@breadcrumbs" data-helper="breadcrumbs" data-html-value="true"></span>
|
|
72
|
+
</div>
|
|
73
|
+
<p class="dx-result-title">
|
|
74
|
+
<a class="CoveoResultLink"></a>
|
|
75
|
+
</p>
|
|
76
|
+
<p class="dx-result-excerpt CoveoExcerpt"></p>
|
|
77
|
+
</div>
|
|
78
|
+
</script>
|
|
79
|
+
<script
|
|
80
|
+
id="myDocumentResultTemplate"
|
|
81
|
+
class="result-template"
|
|
82
|
+
type="text/html"
|
|
83
|
+
data-field-publicurl=""
|
|
84
|
+
data-condition="!raw.breadcrumbs"
|
|
85
|
+
>
|
|
86
|
+
<div class="dx-result">
|
|
87
|
+
<div class="dx-result-info">
|
|
88
|
+
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
89
|
+
<span class="CoveoFieldValue" data-field="@uri" data-helper="uriBreadcrumbs" data-html-value="true"></span>
|
|
90
|
+
</div>
|
|
91
|
+
<p class="dx-result-title">
|
|
92
|
+
<a
|
|
93
|
+
class="CoveoResultLink"
|
|
94
|
+
data-field="@publicurl"
|
|
95
|
+
></a>
|
|
96
|
+
</p>
|
|
97
|
+
<p class="dx-result-excerpt CoveoExcerpt"></p>
|
|
98
|
+
</div>
|
|
99
|
+
</script>
|
|
100
|
+
<script
|
|
101
|
+
id="myDefaultResultTemplate"
|
|
102
|
+
class="result-template"
|
|
103
|
+
type="text/html"
|
|
104
|
+
data-condition="!raw.breadcrumbs"
|
|
105
|
+
>
|
|
106
|
+
<div class="dx-result">
|
|
107
|
+
<div class="dx-result-info">
|
|
108
|
+
<span class="CoveoFieldValue" data-field="@content_type" data-helper="badge" data-html-value="true"></span>
|
|
71
109
|
<span class="CoveoFieldValue" data-field="@uri" data-helper="uriBreadcrumbs" data-html-value="true"></span>
|
|
72
110
|
</div>
|
|
73
111
|
<p class="dx-result-title">
|
|
@@ -118,14 +156,10 @@ const processParts = (parts: string[]) => {
|
|
|
118
156
|
const buildTemplateHelperUriBreadcrumbs = (value: string) => {
|
|
119
157
|
const url = new URL(value);
|
|
120
158
|
|
|
121
|
-
//
|
|
122
|
-
const hostnamePattern =
|
|
123
|
-
|
|
124
|
-
if (
|
|
125
|
-
hostnamePattern.test(url.hostname) &&
|
|
126
|
-
!/\/blogs|\/podcast/.test(url.pathname) &&
|
|
127
|
-
!/\/docs\/component-library/.test(url.pathname)
|
|
128
|
-
) {
|
|
159
|
+
// exclude youtube links from breadcrumbs
|
|
160
|
+
const hostnamePattern = /^((www\.)?(youtube\.com|youtu\.be))$/;
|
|
161
|
+
|
|
162
|
+
if (hostnamePattern.test(url.hostname)) {
|
|
129
163
|
return "";
|
|
130
164
|
}
|
|
131
165
|
|
|
@@ -143,7 +177,7 @@ const buildTemplateHelperUriBreadcrumbs = (value: string) => {
|
|
|
143
177
|
|
|
144
178
|
const breadcrumbs = processParts(parts);
|
|
145
179
|
|
|
146
|
-
// if url.hostname is developer.salesforce.com or developer-website-s.herokuapp.com, remove the first
|
|
180
|
+
// if url.hostname is developer.salesforce.com or developer-website-s.herokuapp.com, remove the first breadcrumb item
|
|
147
181
|
if (
|
|
148
182
|
url.hostname !== "developer.salesforce.com" &&
|
|
149
183
|
url.hostname !== "developer-website-s.herokuapp.com"
|
|
@@ -161,21 +195,14 @@ const buildTemplateHelperUriBreadcrumbs = (value: string) => {
|
|
|
161
195
|
return "";
|
|
162
196
|
}
|
|
163
197
|
|
|
164
|
-
// remove the last breadcrumb item (since the search result is the last item
|
|
198
|
+
// remove the last breadcrumb item (since the search result is the last item in the breadcrumb trail)
|
|
165
199
|
breadcrumbs.pop();
|
|
166
200
|
|
|
167
201
|
return `<span class="breadcrumb">/ ${breadcrumbs.join(" / ")} /</span>`;
|
|
168
202
|
};
|
|
169
203
|
|
|
170
204
|
const buildTemplateHelperBreadcrumbs = (value: string) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
if (value.includes("developer.salesforce.com")) {
|
|
174
|
-
const url = new URL(value);
|
|
175
|
-
parts = url.pathname.split("/").filter((part) => part !== "");
|
|
176
|
-
} else {
|
|
177
|
-
parts = value.split("/").filter((part) => part !== "");
|
|
178
|
-
}
|
|
205
|
+
const parts = value.split("/").filter((part) => part !== "");
|
|
179
206
|
|
|
180
207
|
// Don't show breadcrumbs if there's only one part or two (two because we remove the last item in the next step)
|
|
181
208
|
if (parts.length === 1) {
|