@salesforcedevs/dx-components 1.3.91 → 1.3.92
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/LICENSE +12 -0
- package/package.json +3 -2
- package/src/modules/dx/audio/audio.ts +6 -6
- package/src/modules/dx/cardNews/cardNews.html +3 -1
- package/src/modules/dx/cardNews/cardNews.ts +0 -4
- package/src/modules/dx/formattedRichText/formattedRichText.html +3 -0
- package/src/modules/dx/formattedRichText/formattedRichText.ts +17 -0
- package/src/modules/dx/searchResults/searchResults.ts +25 -9
- package/src/modules/dx/sidebar/sidebar.html +5 -0
- package/src/modules/dx/sidebarOld/sidebarOld.html +4 -0
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +21 -15
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.html +1 -1
- package/src/modules/dx/sidebarSearchResult/sidebarSearchResult.ts +1 -0
- package/src/modules/dxHelpers/commonSidebar/commonSidebar.css +12 -0
- package/src/modules/dxHelpers/typeBadge/typeBadge.css +1 -0
- package/src/modules/dxUtils/sanitizeHtml/sanitizeHtml.ts +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.92",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -39,5 +39,6 @@
|
|
|
39
39
|
"@types/vimeo__player": "^2.16.2",
|
|
40
40
|
"eventsourcemock": "^2.0.0",
|
|
41
41
|
"luxon": "^3.1.0"
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
|
+
"gitHead": "c8219382fa130a3c0136d76c0581dcaa893b0c6d"
|
|
43
44
|
}
|
|
@@ -24,14 +24,14 @@ export default class Audio extends LightningElement {
|
|
|
24
24
|
);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
private trackClick(e: Event,
|
|
27
|
+
private trackClick(e: Event, eventType: string, action: string) {
|
|
28
28
|
const audioElement = this.template.querySelector(
|
|
29
29
|
"audio"
|
|
30
30
|
) as HTMLMediaElement;
|
|
31
31
|
|
|
32
32
|
const payload = {
|
|
33
|
-
event:
|
|
34
|
-
media_action:
|
|
33
|
+
event: eventType,
|
|
34
|
+
media_action: action,
|
|
35
35
|
media_name: this.postName,
|
|
36
36
|
media_percentage_played: (
|
|
37
37
|
(audioElement!.currentTime * 100) /
|
|
@@ -44,12 +44,12 @@ export default class Audio extends LightningElement {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
private trackPlay(e: Event) {
|
|
47
|
-
this.trackClick(e, "play");
|
|
47
|
+
this.trackClick(e, "custEv_blogAudioPlay", "play");
|
|
48
48
|
}
|
|
49
49
|
private trackEnded(e: Event) {
|
|
50
|
-
this.trackClick(e, "complete");
|
|
50
|
+
this.trackClick(e, "custEv_blogAudioComplete", "complete");
|
|
51
51
|
}
|
|
52
52
|
private trackPause(e: Event) {
|
|
53
|
-
this.trackClick(e, "pause");
|
|
53
|
+
this.trackClick(e, "custEv_blogAudioPause", "pause");
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
part="container"
|
|
9
9
|
>
|
|
10
10
|
<div class={textContainerClassName}>
|
|
11
|
-
<h3 class="dx-text-display-4"
|
|
11
|
+
<h3 class="dx-text-display-4">
|
|
12
|
+
<dx-formatted-rich-text value={title}></dx-formatted-rich-text>
|
|
13
|
+
</h3>
|
|
12
14
|
<p>{body}</p>
|
|
13
15
|
<div class="cta">
|
|
14
16
|
<dx-button if:true={hasLargeButton} size="large">
|
|
@@ -29,10 +29,6 @@ export default class CardNews extends LightningElement {
|
|
|
29
29
|
@api target?: string | null = null;
|
|
30
30
|
@api textContainerWidth?: CardNewsTextContainerSize = "small";
|
|
31
31
|
|
|
32
|
-
renderedCallback() {
|
|
33
|
-
this.template.querySelector("h3").innerHTML = this.title;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
32
|
private get style(): string {
|
|
37
33
|
const background = `background-color: ${toDxColor(
|
|
38
34
|
this.backgroundColor
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { sanitizeHtml } from "dxUtils/sanitizeHtml";
|
|
3
|
+
|
|
4
|
+
export default class FormattedRichText extends LightningElement {
|
|
5
|
+
@api value!: string;
|
|
6
|
+
|
|
7
|
+
private get sanitizedValue(): string {
|
|
8
|
+
return sanitizeHtml(this.value);
|
|
9
|
+
}
|
|
10
|
+
renderedCallback() {
|
|
11
|
+
const containerEl = this.template.querySelector(".container");
|
|
12
|
+
|
|
13
|
+
if (containerEl) {
|
|
14
|
+
containerEl.innerHTML = this.sanitizedValue;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api, track } from "lwc";
|
|
2
2
|
import type * as CoveoSDK from "coveo-search-ui";
|
|
3
3
|
import { track as trackGTM } from "dxUtils/analytics";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CONTENT_TYPE_LABELS,
|
|
6
|
+
CONTENT_TYPE_ICONS
|
|
7
|
+
} from "dxConstants/contentTypes";
|
|
5
8
|
import { getContentTypeColorVariables } from "dxUtils/contentTypes";
|
|
6
9
|
|
|
7
10
|
interface CoveoSearch {
|
|
@@ -19,9 +22,7 @@ interface CoveoSearch {
|
|
|
19
22
|
|
|
20
23
|
declare const Coveo: CoveoSearch;
|
|
21
24
|
|
|
22
|
-
function getPaginationState(
|
|
23
|
-
event: CoveoSDK.IQuerySuccessEventArgs
|
|
24
|
-
): {
|
|
25
|
+
function getPaginationState(event: CoveoSDK.IQuerySuccessEventArgs): {
|
|
25
26
|
numberOfPages: number;
|
|
26
27
|
currentPage: number;
|
|
27
28
|
} {
|
|
@@ -67,6 +68,25 @@ const resultsTemplatesInnerHtml = `
|
|
|
67
68
|
</script>
|
|
68
69
|
`;
|
|
69
70
|
|
|
71
|
+
const buildTemplateHelperBadge = (value: string) => {
|
|
72
|
+
const style = getContentTypeColorVariables(value);
|
|
73
|
+
const label = CONTENT_TYPE_LABELS[value];
|
|
74
|
+
const { iconSprite, iconSymbol } = CONTENT_TYPE_ICONS[value];
|
|
75
|
+
return `
|
|
76
|
+
<div style="${style}" class="dx-badge">
|
|
77
|
+
<svg
|
|
78
|
+
aria-hidden="true"
|
|
79
|
+
style="display: inline; margin-bottom: 1px; fill: var(--color); height: var(--dx-g-icon-size-xs); width: var(--dx-g-icon-size-xs);"
|
|
80
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
81
|
+
part="svg"
|
|
82
|
+
>
|
|
83
|
+
<use xlink:href="/assets/icons/${iconSprite}-sprite/svg/symbols.svg#${iconSymbol}"></use>
|
|
84
|
+
</svg>
|
|
85
|
+
<span>${label}</span>
|
|
86
|
+
</div>
|
|
87
|
+
`;
|
|
88
|
+
};
|
|
89
|
+
|
|
70
90
|
export default class SearchResults extends LightningElement {
|
|
71
91
|
@api coveoOrganizationId!: string;
|
|
72
92
|
@api coveoPublicAccessToken!: string;
|
|
@@ -179,11 +199,7 @@ export default class SearchResults extends LightningElement {
|
|
|
179
199
|
|
|
180
200
|
Coveo.TemplateHelpers.registerTemplateHelper(
|
|
181
201
|
"badge",
|
|
182
|
-
|
|
183
|
-
const style = getContentTypeColorVariables(value);
|
|
184
|
-
const label = CONTENT_TYPE_LABELS[value];
|
|
185
|
-
return `<div style="${style}" class="dx-badge"><span>${label}</span></div>`;
|
|
186
|
-
}
|
|
202
|
+
buildTemplateHelperBadge
|
|
187
203
|
);
|
|
188
204
|
|
|
189
205
|
Coveo.init(this.root);
|
|
@@ -32,6 +32,10 @@
|
|
|
32
32
|
<h2 class="dx-text-display-6 header-title">{header}</h2>
|
|
33
33
|
<slot name="header"></slot>
|
|
34
34
|
</div>
|
|
35
|
+
<div class="mobile-header" if:true={mobile}>
|
|
36
|
+
<h2 class="dx-text-display-6">{header}</h2>
|
|
37
|
+
<slot name="header"></slot>
|
|
38
|
+
</div>
|
|
35
39
|
<div class="search">
|
|
36
40
|
<dx-sidebar-search
|
|
37
41
|
onchange={onSearchChange}
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
selected={result.selected}
|
|
73
77
|
title-highlights={result.titleHighlights}
|
|
74
78
|
title={result.title}
|
|
79
|
+
select={result.select}
|
|
75
80
|
></dx-sidebar-search-result>
|
|
76
81
|
</template>
|
|
77
82
|
<dx-empty-state
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
<h2 class="dx-text-display-6 header-title">{header}</h2>
|
|
35
35
|
<slot name="header"></slot>
|
|
36
36
|
</div>
|
|
37
|
+
<div class="mobile-header" if:true={mobile}>
|
|
38
|
+
<h2 class="dx-text-display-6">{header}</h2>
|
|
39
|
+
<slot name="header"></slot>
|
|
40
|
+
</div>
|
|
37
41
|
<div class="search">
|
|
38
42
|
<dx-input
|
|
39
43
|
class="search-box"
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
Unsubscribe,
|
|
7
7
|
ResultsPerPage,
|
|
8
8
|
SearchBox,
|
|
9
|
+
buildInteractiveResult,
|
|
9
10
|
buildResultList,
|
|
10
11
|
buildResultsPerPage,
|
|
11
12
|
buildSearchBox,
|
|
@@ -247,11 +248,8 @@ export default class SidebarSearch extends LightningElement {
|
|
|
247
248
|
return;
|
|
248
249
|
}
|
|
249
250
|
|
|
250
|
-
const {
|
|
251
|
-
|
|
252
|
-
firstSearchExecuted,
|
|
253
|
-
results
|
|
254
|
-
} = this.resultList.state;
|
|
251
|
+
const { isLoading, firstSearchExecuted, results } =
|
|
252
|
+
this.resultList.state;
|
|
255
253
|
|
|
256
254
|
if ((!firstSearchExecuted && !isLoading) || !this.value) {
|
|
257
255
|
// coveo search is firing off some unwanted payloads on startup
|
|
@@ -289,15 +287,22 @@ export default class SidebarSearch extends LightningElement {
|
|
|
289
287
|
engine.dispatch(registerSearchQueryAction);
|
|
290
288
|
}
|
|
291
289
|
|
|
292
|
-
private normalizeCoveoResult = ({
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
290
|
+
private normalizeCoveoResult = (result: Result): SidebarSearchResult => {
|
|
291
|
+
const {
|
|
292
|
+
clickUri,
|
|
293
|
+
excerpt,
|
|
294
|
+
excerptHighlights,
|
|
295
|
+
raw: { sfhtml_url__c },
|
|
296
|
+
title,
|
|
297
|
+
titleHighlights,
|
|
298
|
+
uniqueId
|
|
299
|
+
} = result;
|
|
300
|
+
|
|
301
|
+
const interactiveResult = buildInteractiveResult(this.engine!, {
|
|
302
|
+
options: { result }
|
|
303
|
+
});
|
|
304
|
+
interactiveResult.cancelPendingSelect();
|
|
305
|
+
|
|
301
306
|
// discussion about this normalization here: https://salesforce-internal.slack.com/archives/C020S6784JX/p1639506238376600
|
|
302
307
|
|
|
303
308
|
let pathname, queryParam;
|
|
@@ -348,7 +353,8 @@ export default class SidebarSearch extends LightningElement {
|
|
|
348
353
|
excerptHighlights,
|
|
349
354
|
uniqueId,
|
|
350
355
|
href,
|
|
351
|
-
selected: isSelected
|
|
356
|
+
selected: isSelected,
|
|
357
|
+
select: interactiveResult.select
|
|
352
358
|
};
|
|
353
359
|
};
|
|
354
360
|
|
|
@@ -55,6 +55,7 @@ export default class SidebarSearchResult extends LightningElement {
|
|
|
55
55
|
@api selected!: boolean;
|
|
56
56
|
@api title!: string;
|
|
57
57
|
@api titleHighlights!: CoveoHighlights;
|
|
58
|
+
@api select!: Function;
|
|
58
59
|
|
|
59
60
|
private get titleChunks() {
|
|
60
61
|
return toChunks(this.title, this.titleHighlights);
|
|
@@ -24,6 +24,12 @@ dx-tree:not(:last-child) {
|
|
|
24
24
|
margin-bottom: 12px;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
.mobile-header {
|
|
28
|
+
display: flex;
|
|
29
|
+
line-height: var(--dx-g-spacing-xl);
|
|
30
|
+
margin-bottom: 12px;
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
.padding-horizontal {
|
|
28
34
|
padding-left: var(--dx-g-spacing-md);
|
|
29
35
|
padding-right: var(--dx-g-spacing-md);
|
|
@@ -107,6 +113,12 @@ dx-tree:not(:last-child) {
|
|
|
107
113
|
background-color: #dddbda;
|
|
108
114
|
}
|
|
109
115
|
|
|
116
|
+
/* This class checks if an element with container class has an elemnt with container-mobile class and
|
|
117
|
+
must not contain any collapsed class and finally must have a mobile-header class (to which this css will be applied) */
|
|
118
|
+
.container.container-mobile:not(.collapsed) .mobile-header {
|
|
119
|
+
background-color: var(--dx-g-gray-95);
|
|
120
|
+
}
|
|
121
|
+
|
|
110
122
|
.container.container-mobile .header-title {
|
|
111
123
|
color: var(--dx-g-gray-10);
|
|
112
124
|
font-family: var(--dx-g-font-sans);
|