@salesforcedevs/dw-components 1.2.17-canary.1 → 1.2.20

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 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/lwc.config.json CHANGED
@@ -20,7 +20,6 @@
20
20
  "dw/podcastsPromo",
21
21
  "dw/rcgTable",
22
22
  "dw/slackCta",
23
- "dw/slackSuccess",
24
- "dw/tbidLoginMenu"
23
+ "dw/slackSuccess"
25
24
  ]
26
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.2.17-canary.1",
3
+ "version": "1.2.20",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -21,5 +21,6 @@
21
21
  "@types/lodash.clonedeep": "^4.5.7",
22
22
  "@types/lodash.orderby": "^4.6.7",
23
23
  "@types/lodash.uniqby": "^4.7.7"
24
- }
24
+ },
25
+ "gitHead": "466ea9180b7fee81eda0ea7abe6faae3cf2e54f9"
25
26
  }
@@ -56,14 +56,7 @@ export default abstract class EventsList extends LightningElement {
56
56
  }
57
57
 
58
58
  set events(value) {
59
- const tempDate = new Date();
60
- tempDate.setMonth(tempDate.getMonth() - 2);
61
- const twoMonthsAgo = tempDate.toISOString();
62
- // Show past two months of events and all upcoming events
63
- const events = toJson(value).filter(
64
- (event) => event.startDate > twoMonthsAgo
65
- );
66
- this._events = events;
59
+ this._events = toJson(value);
67
60
  this.createFilters();
68
61
  }
69
62
 
@@ -1,119 +0,0 @@
1
- :host {
2
- --dx-c-button-custom-color: var(--dx-g-blue-vibrant-50);
3
- --dx-c-button-custom-background: transparent;
4
- --dx-c-button-custom-border: 1px solid transparent;
5
- --dx-c-button-custom-color-hover: var(--dx-g-blue-vibrant-50);
6
- --dx-c-button-custom-background-hover: var(--dx-g-cloud-blue-vibrant-90);
7
- --dx-c-button-custom-border-hover: var(--dx-g-cloud-blue-vibrant-90);
8
- --dx-c-slot-empty-width: max-content;
9
- }
10
-
11
- .avatar {
12
- border-radius: 100%;
13
- border: 2px solid #0d9dda;
14
- }
15
-
16
- .avatar.avatar-medium {
17
- margin-bottom: 14px;
18
- width: var(--dx-g-spacing-2xl);
19
- }
20
-
21
- .login-container {
22
- padding: 16px;
23
- }
24
-
25
- .login-container.logged-in {
26
- padding-top: 68px;
27
- }
28
-
29
- .header-img {
30
- left: 0;
31
- position: absolute;
32
- top: 0;
33
- width: 100%;
34
- z-index: -1;
35
- }
36
-
37
- .heading {
38
- color: var(--dx-g-blue-vibrant-20);
39
- display: block;
40
- font-family: var(--dx-g-font-display);
41
- font-size: var(--dx-g-text-lg);
42
- line-height: 28px;
43
- }
44
-
45
- .sub-heading {
46
- color: var(--dx-g-blue-vibrant-20);
47
- display: block;
48
- font-family: var(--dx-g-font-sans);
49
- font-size: 12px;
50
- line-height: 18px;
51
- padding: 8px 0;
52
- }
53
-
54
- ul {
55
- list-style: none;
56
- margin: 0;
57
- padding: 0;
58
- }
59
-
60
- .login-list-item {
61
- padding-bottom: 10px;
62
- }
63
-
64
- .login-section ~ .login-section {
65
- border-top: 1px solid var(--dx-g-gray-90);
66
- margin-top: 12px;
67
- }
68
-
69
- .login-section-title {
70
- color: var(--dx-g-gray-30);
71
- display: inline-block;
72
- font-family: var(--dx-g-font-sans);
73
- font-size: 14px;
74
- line-height: 20px;
75
- padding: 20px 0 12px;
76
- }
77
-
78
- .login-link {
79
- color: var(--dx-g-blue-vibrant-20);
80
- display: inline-block;
81
- }
82
-
83
- .login-link-label {
84
- display: inline-block;
85
- font-family: var(--dx-g-font-display);
86
- font-size: 16px;
87
- line-height: 24px;
88
- }
89
-
90
- .login-link-img {
91
- display: inline-block;
92
- height: 16px;
93
- margin-left: 6px;
94
- vertical-align: sub;
95
- }
96
-
97
- .login-link-icon {
98
- display: inline-block;
99
- margin-left: 6px;
100
- vertical-align: text-bottom;
101
- }
102
-
103
- .login-link-blurb {
104
- font-family: var(--dx-g-font-sans);
105
- font-size: 14px;
106
- line-height: 20px;
107
- padding-top: 4px;
108
- }
109
-
110
- .heading-links {
111
- color: var(--dx-g-gray-90);
112
- font-family: var(--dx-g-font-sans);
113
- font-size: 14px;
114
- line-height: 20px;
115
- }
116
-
117
- a.inline-link {
118
- color: var(--dx-g-blue-vibrant-50);
119
- }
@@ -1,192 +0,0 @@
1
- <template>
2
- <dx-tbid-avatar-button
3
- tbid-base-url={tbidBaseUrl}
4
- tbid-api-base-url={tbidApiBaseUrl}
5
- ontbiduserinfo={handleTbidUserInfo}
6
- ontbidloginsuccess={handleTbidLoginSuccess}
7
- ontbidlogoutsuccess={handleTbidLogoutSuccess}
8
- >
9
- <div slot="popover-content">
10
- <div if:true={isLoggedIn}>
11
- <div class="login-container logged-in">
12
- <img
13
- src="/assets/svg/login-widget-bg.png"
14
- class="header-img"
15
- alt="Light blue background image showing line-drawn hills and trees"
16
- />
17
- <img
18
- src={userInfo.avatarImgSrc}
19
- class="avatar avatar-medium"
20
- alt="Medium user avatar image"
21
- />
22
- <span class="heading">{userInfo.fullName}</span>
23
- <span class="sub-heading">{userInfo.username}</span>
24
- <div class="heading-links">
25
- <a
26
- href="#"
27
- onclick={handleComponentLogoutClick}
28
- class="inline-link"
29
- >
30
- Logout
31
- </a>
32
- </div>
33
- <div class="login-section">
34
- <span class="login-section-title">Trailblazer.me</span>
35
- <ul>
36
- <li class="login-list-item">
37
- <a
38
- href={settingsUrl}
39
- class="login-link"
40
- target="_blank"
41
- rel="noopener"
42
- onclick={trackLoggedInMenuClick}
43
- >
44
- <span class="login-link-label">
45
- Settings
46
- </span>
47
- <dx-icon
48
- class="login-link-icon"
49
- symbol="new_window"
50
- size="xsmall"
51
- ></dx-icon>
52
- </a>
53
- </li>
54
- <li class="login-list-item">
55
- <a
56
- href={profileUrl}
57
- class="login-link"
58
- target="_blank"
59
- rel="noopener"
60
- onclick={trackLoggedInMenuClick}
61
- >
62
- <span class="login-link-label">
63
- Profile
64
- </span>
65
- <dx-icon
66
- class="login-link-icon"
67
- symbol="new_window"
68
- size="xsmall"
69
- ></dx-icon>
70
- </a>
71
- </li>
72
- <li class="login-list-item">
73
- <a
74
- href="https://trailhead.salesforce.com/trailblazer-community/groups/0F93A000000DJbJSAW"
75
- class="login-link"
76
- target="_blank"
77
- rel="noopener"
78
- onclick={trackLoggedInMenuClick}
79
- >
80
- <span class="login-link-label">
81
- Developer Community
82
- </span>
83
- <dx-icon
84
- class="login-link-icon"
85
- symbol="new_window"
86
- size="xsmall"
87
- ></dx-icon>
88
- </a>
89
- <div class="login-link-blurb">
90
- Collaborate, network, build connections and
91
- learn Salesforce development.
92
- </div>
93
- </li>
94
- </ul>
95
- </div>
96
- </div>
97
- </div>
98
- <div if:false={isLoggedIn}>
99
- <div class="login-container">
100
- <span class="heading">Login</span>
101
- <div class="login-section">
102
- <span class="login-section-title">Products</span>
103
- <ul>
104
- <li class="login-list-item">
105
- <a
106
- href="https://www.salesforce.com"
107
- class="login-link"
108
- target="_blank"
109
- rel="noopener"
110
- onclick={trackLoginMenuClick}
111
- >
112
- <span class="login-link-label">
113
- Salesforce
114
- </span>
115
- <img
116
- class="login-link-img"
117
- src="/assets/svg/salesforce-cloud.svg"
118
- alt="Salesforce logo"
119
- />
120
- <dx-icon
121
- class="login-link-icon"
122
- symbol="new_window"
123
- size="xsmall"
124
- ></dx-icon>
125
- </a>
126
- </li>
127
- <li class="login-list-item">
128
- <a
129
- href={marketingCloudUrl}
130
- class="login-link"
131
- target="_blank"
132
- rel="noopener"
133
- onclick={trackLoginMenuClick}
134
- >
135
- <span class="login-link-label">
136
- Marketing Cloud
137
- </span>
138
- <dx-icon
139
- class="login-link-icon"
140
- symbol="new_window"
141
- size="xsmall"
142
- ></dx-icon>
143
- </a>
144
- </li>
145
- </ul>
146
- </div>
147
- <div class="login-section">
148
- <span class="login-section-title">
149
- Salesforce Developers
150
- </span>
151
- <ul>
152
- <li class="login-list-item">
153
- <a
154
- href={loginUrl}
155
- class="login-link"
156
- onclick={handleComponentLoginClick}
157
- >
158
- <span class="login-link-label">
159
- Trailblazer.me
160
- </span>
161
- </a>
162
- <div class="login-link-blurb">
163
- Login into access a rich community of
164
- Salesforce Developers, get ideas, and find
165
- solutions.
166
- </div>
167
- </li>
168
- <li class="login-list-item">
169
- <a
170
- href="https://developer.salesforce.com/forums"
171
- class="login-link"
172
- target="_blank"
173
- rel="noopener"
174
- onclick={trackLoginMenuClick}
175
- >
176
- <span class="login-link-label">
177
- Developer Forums
178
- </span>
179
- <dx-icon
180
- class="login-link-icon"
181
- symbol="new_window"
182
- size="xsmall"
183
- ></dx-icon>
184
- </a>
185
- </li>
186
- </ul>
187
- </div>
188
- </div>
189
- </div>
190
- </div>
191
- </dx-tbid-avatar-button>
192
- </template>
@@ -1,165 +0,0 @@
1
- import { LightningElement } from "lwc";
2
- import { track } from "dxUtils/analytics";
3
- import TbidAvatarButton from "dx/tbidAvatarButton";
4
-
5
- const DSC_BASE_URL = process.env.BASE_URL || "https://developer.salesforce.com";
6
-
7
- interface UserInfo {
8
- avatarImgSrc?: string;
9
- company?: string;
10
- firstName?: string;
11
- id?: string;
12
- lastName?: string;
13
- orgId?: string;
14
- relationship?: string;
15
- role?: string;
16
- username?: string;
17
- fullName?: string;
18
- }
19
-
20
- const trackableUserInfo = new Set([
21
- "company",
22
- "id",
23
- "orgId",
24
- "relationship",
25
- "role"
26
- ]);
27
-
28
- // This component is DSC-specific, essentially just handling tracking and UI for the TBID login menu.
29
- // TBID-login-related *functionality* is handled by the generic and hopefully-reusable dx/tbidAvatarButton,
30
- // which this component uses.
31
- export default class TbidLoginMenu extends LightningElement {
32
- // URLs:
33
- private tbidBaseUrl = process.env.TBID_BASE_URL || "";
34
- private tbidApiBaseUrl = `${
35
- process.env.TBID_API_BASE_URL || "https://developer.salesforce.com"
36
- }/tbid`;
37
- private settingsUrl = `${this.tbidBaseUrl}/settings`;
38
- private profileUrl = `${this.tbidBaseUrl}/id`;
39
- private logoutUrl = `${this.tbidApiBaseUrl}/logout`;
40
- private get marketingCloudUrl() {
41
- return `${DSC_BASE_URL}/developer-centers/marketing-cloud`;
42
- }
43
- private get loginUrl() {
44
- return `${this.tbidApiBaseUrl}/dologin?startURL=${encodeURIComponent(
45
- window.location.href
46
- )}`;
47
- }
48
-
49
- private isLoggedIn = false;
50
- private userInfo: UserInfo = {};
51
-
52
- private handleComponentLogoutClick = (event: Event) => {
53
- event.preventDefault();
54
- this.trackLogoutClick();
55
- (
56
- this.template.querySelector(
57
- "dx-tbid-avatar-button"
58
- ) as unknown as TbidAvatarButton
59
- ).logout();
60
- };
61
-
62
- private handleComponentLoginClick = (event: Event) => {
63
- this.trackLoginClick();
64
- (
65
- this.template.querySelector(
66
- "dx-tbid-avatar-button"
67
- ) as unknown as TbidAvatarButton
68
- ).login(event);
69
- };
70
-
71
- private handleTbidLoginSuccess = (event: CustomEvent) => {
72
- event.stopPropagation();
73
- this.isLoggedIn = true;
74
-
75
- // Special tracking for this event only
76
- track(document, "custEv_userLogin", {
77
- authenticationMethod: "tbid",
78
- id: {
79
- tb: Object.entries(this.userInfo)
80
- .filter(([key]) => trackableUserInfo.has(key))
81
- .reduce(
82
- (infoToTrack, [key, value]) => ({
83
- ...infoToTrack,
84
- [key]: value
85
- }),
86
- {} as Record<string, string>
87
- )
88
- }
89
- });
90
- };
91
-
92
- private handleTbidLogoutSuccess = (event: CustomEvent) => {
93
- event.stopPropagation();
94
- this.isLoggedIn = false;
95
- this.userInfo = {};
96
- };
97
-
98
- private handleTbidUserInfo = (event: CustomEvent) => {
99
- event.stopPropagation();
100
- const { detail } = event;
101
- if (detail && detail.userInfo) {
102
- this.userInfo = detail.userInfo;
103
-
104
- if (!this.isLoggedIn) {
105
- // If we are not "logged in" but we receive userInfo, it means the user has a valid
106
- // session cookie that was re-used without login, and we should update the UI to a
107
- // logged in state.
108
- this.isLoggedIn = true;
109
- }
110
- }
111
- };
112
-
113
- private trackLoginClick = () => {
114
- track(document, "custEv_userLogin", {
115
- clickText: "Trailblazer.me",
116
- clickUrl: this.loginUrl,
117
- itemTitle: "TBID Login Link",
118
- elementType: "link"
119
- });
120
- };
121
-
122
- private trackLogoutClick = () => {
123
- track(document, "custEv_userLogout", {
124
- clickText: "Logout",
125
- clickUrl: this.logoutUrl,
126
- itemTitle: "TBID Logout Link",
127
- elementType: "link"
128
- });
129
- };
130
-
131
- // Shared utility for tracking link clicks.
132
- private trackMenuClick = (
133
- target: HTMLAnchorElement | null,
134
- eventName: string,
135
- navItemPrefix: string
136
- ) => {
137
- const trackingPayload: any = {
138
- nav_level: "utility",
139
- nav_type: "global",
140
- elementType: "link"
141
- };
142
-
143
- if (target) {
144
- trackingPayload.clickText = target.textContent?.trim() || "";
145
- trackingPayload.clickUrl = target.href;
146
- const [firstWord, ...remainingText] =
147
- trackingPayload.clickText.split(" ");
148
- trackingPayload.nav_item = `${navItemPrefix}${firstWord.toLowerCase()}${remainingText.join()}`;
149
- }
150
-
151
- track(target || document, eventName, trackingPayload);
152
- };
153
-
154
- // Track link clicks on the "logged out" version of the dropdown.
155
- private trackLoginMenuClick = (event: Event) => {
156
- const target = event.currentTarget as HTMLAnchorElement | null;
157
- this.trackMenuClick(target, "custEv_userLogin", "login:salesforce:");
158
- };
159
-
160
- // Track link clicks on the "logged in" version of the dropdown.
161
- private trackLoggedInMenuClick = (event: Event) => {
162
- const target = event.currentTarget as HTMLAnchorElement | null;
163
- this.trackMenuClick(target, "custEv_loginMenuClick", "login:tbid:");
164
- };
165
- }