@salesforcedevs/dx-components 1.3.92 → 1.3.96-alpha

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/dx-components",
3
- "version": "1.3.92",
3
+ "version": "1.3.96-alpha",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -39,6 +39,5 @@
39
39
  "@types/vimeo__player": "^2.16.2",
40
40
  "eventsourcemock": "^2.0.0",
41
41
  "luxon": "^3.1.0"
42
- },
43
- "gitHead": "c8219382fa130a3c0136d76c0581dcaa893b0c6d"
42
+ }
44
43
  }
@@ -40,6 +40,7 @@ export default class Audio extends LightningElement {
40
40
  media_seconds_played: audioElement!.currentTime,
41
41
  media_type: "blog audio"
42
42
  };
43
+
43
44
  track(e.currentTarget!, "custEv_blogAudioPlay", payload);
44
45
  }
45
46
 
@@ -24,6 +24,7 @@ import {
24
24
  SidebarSearchResult
25
25
  } from "typings/custom";
26
26
 
27
+ const RESULT_CLICK_LOCAL_STORAGE_KEY = "dx-sidebar-search-result-click";
27
28
  export const SESSION_KEY = "dx-sidebar-search-state";
28
29
 
29
30
  const DEFAULT_RESULT_COUNT = 20;
@@ -241,6 +242,22 @@ export default class SidebarSearch extends LightningElement {
241
242
  this.dispatchOnLoading(false);
242
243
  }
243
244
  }
245
+
246
+ this.syncAnalytics();
247
+ };
248
+
249
+ private syncAnalytics = () => {
250
+ const storedResult = window.localStorage.getItem(
251
+ RESULT_CLICK_LOCAL_STORAGE_KEY
252
+ );
253
+ if (storedResult) {
254
+ const interactiveResult = buildInteractiveResult(this.engine!, {
255
+ options: { result: JSON.parse(storedResult) }
256
+ });
257
+ interactiveResult.cancelPendingSelect();
258
+ interactiveResult.select();
259
+ window.localStorage.removeItem(RESULT_CLICK_LOCAL_STORAGE_KEY);
260
+ }
244
261
  };
245
262
 
246
263
  private onResultListChange = () => {
@@ -298,11 +315,6 @@ export default class SidebarSearch extends LightningElement {
298
315
  uniqueId
299
316
  } = result;
300
317
 
301
- const interactiveResult = buildInteractiveResult(this.engine!, {
302
- options: { result }
303
- });
304
- interactiveResult.cancelPendingSelect();
305
-
306
318
  // discussion about this normalization here: https://salesforce-internal.slack.com/archives/C020S6784JX/p1639506238376600
307
319
 
308
320
  let pathname, queryParam;
@@ -354,7 +366,11 @@ export default class SidebarSearch extends LightningElement {
354
366
  uniqueId,
355
367
  href,
356
368
  selected: isSelected,
357
- select: interactiveResult.select
369
+ select: () =>
370
+ window.localStorage.setItem(
371
+ RESULT_CLICK_LOCAL_STORAGE_KEY,
372
+ JSON.stringify(result)
373
+ )
358
374
  };
359
375
  };
360
376
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <a class={className} href={href} onclick={select}>
2
+ <a class={className} href={href} onclick={onClick}>
3
3
  <span class="title search-text">
4
4
  <template for:each={titleChunks} for:item="chunk">
5
5
  <span class={chunk.class} key={chunk.id}>{chunk.value}</span>
@@ -68,4 +68,10 @@ export default class SidebarSearchResult extends LightningElement {
68
68
  private get className(): string {
69
69
  return cx("sidebar-item", this.selected && "sidebar-item-selected");
70
70
  }
71
+
72
+ private onClick(e: PointerEvent) {
73
+ e.preventDefault();
74
+ this.select();
75
+ window.location.href = this.href;
76
+ }
71
77
  }
@@ -76,11 +76,19 @@ export default class TreeItem extends LightningElement {
76
76
  }
77
77
 
78
78
  private get href(): string | undefined {
79
- return (
79
+ const baseHref =
80
80
  (this._treeNode.link && this._treeNode.link.href) ||
81
81
  this._treeNode.name ||
82
- ""
83
- );
82
+ "";
83
+
84
+ // basically, if this is the root of the page that we're on (the topic title) then modify the href
85
+ // so it will take the user to the top of the page if they click this link
86
+
87
+ if (baseHref === window.location.pathname.split("/").slice(-1)[0]) {
88
+ return baseHref + "#topic-title";
89
+ }
90
+
91
+ return baseHref;
84
92
  }
85
93
 
86
94
  private get target(): string {
@@ -138,11 +146,14 @@ export default class TreeItem extends LightningElement {
138
146
 
139
147
  if (this.isParent) {
140
148
  const isSelectAction = true;
141
- this.doExpand(isSelectAction);
149
+ if (!this.isExpanded) {
150
+ this.doExpand(isSelectAction);
151
+ }
142
152
  }
143
153
 
144
154
  this.sendGtm(event);
145
- this.fireEvent("tileselected", { name: this._treeNode.name });
155
+
156
+ this.fireEvent("tileselected", { name: this.href });
146
157
  }
147
158
 
148
159
  private doExpand(isSelectAction: boolean): void {
@@ -3,7 +3,7 @@
3
3
  color: var(--dx-g-text-heading-color);
4
4
  font-family: var(--dx-g-font-display);
5
5
  font-size: var(--dx-g-text-6xl);
6
- letter-spacing: -1.4px;
6
+ letter-spacing: -1.8px;
7
7
  line-height: 88px;
8
8
  }
9
9
 
@@ -21,7 +21,7 @@
21
21
  color: var(--dx-g-text-heading-color);
22
22
  font-family: var(--dx-g-font-display);
23
23
  font-size: var(--dx-g-text-5xl);
24
- letter-spacing: -0.6px;
24
+ letter-spacing: -1.2px;
25
25
  line-height: 64px;
26
26
  }
27
27
 
@@ -30,7 +30,7 @@
30
30
  color: var(--dx-g-text-heading-color);
31
31
  font-family: var(--dx-g-font-display);
32
32
  font-size: var(--dx-g-text-4xl);
33
- letter-spacing: -0.5px;
33
+ letter-spacing: -1px;
34
34
  line-height: 56px;
35
35
  }
36
36
 
@@ -39,7 +39,7 @@
39
39
  color: var(--dx-g-text-heading-color);
40
40
  font-family: var(--dx-g-font-display);
41
41
  font-size: var(--dx-g-text-3xl);
42
- letter-spacing: -0.3px;
42
+ letter-spacing: -0.8px;
43
43
  line-height: 48px;
44
44
  }
45
45
 
@@ -48,7 +48,7 @@
48
48
  color: var(--dx-g-text-heading-color);
49
49
  font-family: var(--dx-g-font-display);
50
50
  font-size: var(--dx-g-text-2xl);
51
- letter-spacing: -0.1px;
51
+ letter-spacing: -0.4px;
52
52
  line-height: 40px;
53
53
  }
54
54
 
@@ -57,7 +57,7 @@
57
57
  color: var(--dx-g-text-heading-color);
58
58
  font-family: var(--dx-g-font-display);
59
59
  font-size: var(--dx-g-text-xl);
60
- letter-spacing: -0.1px;
60
+ letter-spacing: -0.4px;
61
61
  line-height: 32px;
62
62
  }
63
63
 
@@ -66,7 +66,7 @@
66
66
  color: var(--dx-g-text-heading-color);
67
67
  font-family: var(--dx-g-font-display);
68
68
  font-size: var(--dx-g-text-lg);
69
- letter-spacing: -0.1px;
69
+ letter-spacing: -0.4px;
70
70
  line-height: 28px;
71
71
  }
72
72
 
@@ -75,7 +75,7 @@
75
75
  color: var(--dx-g-text-heading-color);
76
76
  font-family: var(--dx-g-font-display);
77
77
  font-size: var(--dx-g-text-base);
78
- letter-spacing: -0.1px;
78
+ letter-spacing: -0.5px;
79
79
  line-height: 24px;
80
80
  }
81
81
 
@@ -60,22 +60,7 @@ export function sortSplittedPostsByMonth(postsByMonth: any) {
60
60
  return sortedPostsByMonth;
61
61
  }
62
62
 
63
- export function convertForDaylightSavings(
64
- date: string,
65
- zone: string = "local"
66
- ) {
67
- if (!hasDST(zone)) {
68
- return DateTime.fromISO(date).setZone(zone);
69
- }
70
-
71
- return DateTime.fromISO(date).setZone(zone).isInDST
72
- ? DateTime.fromISO(date).setZone(zone)
73
- : DateTime.fromISO(date).setZone(zone).plus({ hour: 1 });
74
- }
75
-
76
- export function hasDST(zone: string = "local") {
77
- return (
78
- DateTime.fromISO("2022-01-01").setZone(zone).isInDST !==
79
- DateTime.fromISO("2022-06-01").setZone(zone).isInDST
80
- );
63
+ export function convertForDaylightSavings(utcIsoString: string) {
64
+ const utcDate = DateTime.fromISO(utcIsoString, { zone: "utc" });
65
+ return utcDate.toLocal();
81
66
  }
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.