@salesforcedevs/dx-components 0.42.1 → 0.43.0-alpha.0

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": "0.42.1",
3
+ "version": "0.43.0-alpha.0",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -27,6 +27,5 @@
27
27
  "@types/debounce": "^1.2.0",
28
28
  "@types/lodash.get": "^4.4.6",
29
29
  "@types/vimeo__player": "^2.16.2"
30
- },
31
- "gitHead": "a2f25f4210276dc012abc9a9c819a211ddaf6560"
30
+ }
32
31
  }
@@ -16,6 +16,7 @@
16
16
  slot="image-badge"
17
17
  ></dx-icon-badge>
18
18
  <dx-formatted-date-time
19
+ if:true={datetime}
19
20
  slot="datetime"
20
21
  day="2-digit"
21
22
  month="long"
@@ -2,7 +2,7 @@ import { LightningElement, api } from "lwc";
2
2
 
3
3
  export default class CardVideoPreview extends LightningElement {
4
4
  @api body?: string | null = null;
5
- @api datetime!: string;
5
+ @api datetime?: string;
6
6
  @api featured?: boolean = false;
7
7
  @api href!: string;
8
8
  @api imgAlt?: string;
@@ -1,5 +1,19 @@
1
1
  import classNames from "classnames";
2
2
  import { LightningElement, api } from "lwc";
3
+ import { track } from "dx/instrumentation";
4
+
5
+ const ANALYTICS_INFO = {
6
+ clickUrl: window.location.href,
7
+ ctaClick: false,
8
+ elementType: "button",
9
+ destinationType: "internal"
10
+ };
11
+
12
+ enum PaginationClickType {
13
+ Number,
14
+ Next,
15
+ Previous
16
+ }
3
17
 
4
18
  export default class Pagination extends LightningElement {
5
19
  @api currentPage: string = "1";
@@ -76,18 +90,43 @@ export default class Pagination extends LightningElement {
76
90
  }
77
91
 
78
92
  private onPageChange(e: Event) {
93
+ const page = this.calculatePage(e);
94
+ const clickType = this.getPaginationClickType(e);
95
+
96
+ track(e.currentTarget!, "custEv_pagination", {
97
+ ...ANALYTICS_INFO,
98
+ clickText:
99
+ clickType === PaginationClickType.Number
100
+ ? page
101
+ : (e.target as HTMLElement).dataset.partId
102
+ });
103
+
104
+ this.dispatchEvent(new CustomEvent("pagechange", { detail: page }));
105
+ }
106
+
107
+ private getPaginationClickType(e: Event): PaginationClickType {
79
108
  const button = (e.target as HTMLElement).dataset.partId;
80
- let page = this.returnPage(button);
81
- if (page === 0) {
82
- page = +(e.target as HTMLElement).dataset.pageId!;
109
+ if (button === "previous") {
110
+ return PaginationClickType.Previous;
111
+ } else if (button === "next") {
112
+ return PaginationClickType.Next;
83
113
  }
84
- this.dispatchEvent(new CustomEvent("pagechange", { detail: page }));
114
+
115
+ return PaginationClickType.Number;
85
116
  }
86
117
 
87
- private returnPage(button: string) {
88
- if (!button) {
89
- return 0;
118
+ private calculatePage(e: Event) {
119
+ const clickType = this.getPaginationClickType(e);
120
+
121
+ let page = 0;
122
+ if (clickType === PaginationClickType.Previous) {
123
+ page = this._currentPage - 1;
124
+ } else if (clickType === PaginationClickType.Next) {
125
+ page = this._currentPage + 1;
126
+ } else {
127
+ page = +(e.target as HTMLElement).dataset.pageId!;
90
128
  }
91
- return this._currentPage + (button === "previous" ? -1 : 1);
129
+
130
+ return page;
92
131
  }
93
132
  }
@@ -1,3 +1,3 @@
1
1
  <template>
2
- <div class="video-container"></div>
2
+ <div class="video-container" lwc:dom="manual"></div>
3
3
  </template>
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.