@salesforcedevs/dw-components 1.2.20 → 1.3.5-lightdom-1

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/lwc.config.json CHANGED
@@ -13,6 +13,7 @@
13
13
  "dw/deSignupForm",
14
14
  "dw/docsGrid",
15
15
  "dw/eventsList",
16
+ "dw/getStarted",
16
17
  "dw/instrumentation",
17
18
  "dw/newsletterForm",
18
19
  "dw/podcastSubscription",
@@ -20,6 +21,7 @@
20
21
  "dw/podcastsPromo",
21
22
  "dw/rcgTable",
22
23
  "dw/slackCta",
23
- "dw/slackSuccess"
24
+ "dw/slackSuccess",
25
+ "dw/tbidLoginMenu"
24
26
  ]
25
27
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dw-components",
3
- "version": "1.2.20",
3
+ "version": "1.3.5-lightdom-1",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -21,6 +21,5 @@
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
- },
25
- "gitHead": "466ea9180b7fee81eda0ea7abe6faae3cf2e54f9"
24
+ }
26
25
  }
@@ -222,15 +222,16 @@ export default class DeSignupForm extends LightningElement {
222
222
  ? checkboxes.values.opt_in
223
223
  : "implied";
224
224
 
225
+ const InfoEmail__c =
226
+ this.country.showMarketingField && checkboxes.values.opt_in === ""
227
+ ? "False"
228
+ : "True";
229
+
225
230
  const formData: SignupForm = {
226
231
  user: userData as UserData,
227
232
  eula: this.showLegalCheckbox ? checkboxes.values.eula : ACCEPTED,
228
233
  default_driver: DEFAULT_DRIVER,
229
- InfoEmail__c: this.showLegalCheckbox
230
- ? checkboxes.values.eula === ACCEPTED
231
- ? "True"
232
- : "False"
233
- : "True"
234
+ InfoEmail__c
234
235
  };
235
236
 
236
237
  return formData;
@@ -0,0 +1,44 @@
1
+ .home-banner-main {
2
+ display: flex;
3
+ flex-direction: column;
4
+ justify-content: center;
5
+ align-items: center;
6
+ padding: var(--dx-g-spacing-lg) var(--dx-g-page-padding-horizontal);
7
+ margin-bottom: var(--dx-g-spacing-3xl);
8
+ width: 100%;
9
+ height: 532px;
10
+ text-align: center;
11
+ background-position: center;
12
+ background-size: cover;
13
+ background-repeat: no-repeat;
14
+ background-image: url("/assets/images/home-banner-main.svg");
15
+ }
16
+
17
+ /* WIDESCREEN */
18
+
19
+ @media screen and (min-width: 1440px) {
20
+ .home-banner-main {
21
+ height: calc(100vw * 0.369444);
22
+ }
23
+ }
24
+
25
+ /* TABLET */
26
+
27
+ @media screen and (max-width: 1024px) {
28
+ .home-banner-main {
29
+ height: 380px;
30
+ margin-bottom: var(--dx-g-spacing-xl);
31
+ }
32
+
33
+ .home-banner-main .home-banner_heading {
34
+ font-size: 26px;
35
+ }
36
+ }
37
+
38
+ @media screen and (max-width: 768px) {
39
+ .home-banner-main {
40
+ align-items: flex-start;
41
+ text-align: left;
42
+ margin-bottom: 0;
43
+ }
44
+ }
@@ -0,0 +1,15 @@
1
+ <template lwc:render-mode="light">
2
+ <div class="home-banner-main">
3
+ <h1 class="home-banner_heading dx-text-heading-2">{headerText}</h1>
4
+ <div class="home-banner_button">
5
+ <dx-button
6
+ onclick={trackClick}
7
+ href={href}
8
+ target="_blank"
9
+ size="hero"
10
+ >
11
+ {buttonText}
12
+ </dx-button>
13
+ </div>
14
+ </div>
15
+ </template>
@@ -0,0 +1,26 @@
1
+ import { LightningElement, api } from "lwc";
2
+ import { track } from "dxUtils/analytics";
3
+
4
+ export default class GetStarted extends LightningElement {
5
+ static renderMode = "light";
6
+
7
+ @api
8
+ buttonText = "Get Started";
9
+
10
+ @api
11
+ headerText = "innovation.start(here);";
12
+
13
+ @api
14
+ href = "/get-started";
15
+
16
+ trackClick(event: Event): void {
17
+ track(event.target!, "custEv_ctaButtonClick", {
18
+ clickText: this.buttonText,
19
+ itemTitle: this.headerText,
20
+ clickUrl: this.href,
21
+ elementType: "button",
22
+ destinationType: "internal",
23
+ ctaClick: true
24
+ });
25
+ }
26
+ }
@@ -1,4 +1,4 @@
1
- <template>
1
+ <template lwc:render-mode="light">
2
2
  <div class={containerClass}>
3
3
  <h2 class="dx-text-heading-4"><slot></slot></h2>
4
4
 
@@ -3,6 +3,8 @@ import { SlackCtaBackgroundVariant } from "typings/custom";
3
3
  import cx from "classnames";
4
4
 
5
5
  export default class SlackAdd extends LightningElement {
6
+ static renderMode = "light";
7
+
6
8
  @api innerText?: string = "Add to Slack";
7
9
  @api background?: SlackCtaBackgroundVariant;
8
10
 
@@ -0,0 +1,119 @@
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: var(--dx-g-text-xs);
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: var(--dx-g-text-sm);
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: var(--dx-g-text-base);
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: var(--dx-g-text-sm);
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: var(--dx-g-text-sm);
114
+ line-height: 20px;
115
+ }
116
+
117
+ a.inline-link {
118
+ color: var(--dx-g-blue-vibrant-50);
119
+ }
@@ -0,0 +1,192 @@
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://login.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="https://mc.exacttarget.com/"
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>
@@ -0,0 +1,160 @@
1
+ import { LightningElement } from "lwc";
2
+ import { track } from "dxUtils/analytics";
3
+ import TbidAvatarButton from "dx/tbidAvatarButton";
4
+
5
+ interface UserInfo {
6
+ avatarImgSrc?: string;
7
+ company?: string;
8
+ firstName?: string;
9
+ id?: string;
10
+ lastName?: string;
11
+ orgId?: string;
12
+ relationship?: string;
13
+ role?: string;
14
+ username?: string;
15
+ fullName?: string;
16
+ }
17
+
18
+ const trackableUserInfo = new Set([
19
+ "company",
20
+ "id",
21
+ "orgId",
22
+ "relationship",
23
+ "role"
24
+ ]);
25
+
26
+ // This component is DSC-specific, essentially just handling tracking and UI for the TBID login menu.
27
+ // TBID-login-related *functionality* is handled by the generic and hopefully-reusable dx/tbidAvatarButton,
28
+ // which this component uses.
29
+ export default class TbidLoginMenu extends LightningElement {
30
+ // URLs:
31
+ private tbidBaseUrl = process.env.TBID_BASE_URL || "";
32
+ private tbidApiBaseUrl = `${
33
+ process.env.TBID_API_BASE_URL || "https://developer.salesforce.com"
34
+ }/tbid`;
35
+ private settingsUrl = `${this.tbidBaseUrl}/settings`;
36
+ private profileUrl = `${this.tbidBaseUrl}/id`;
37
+ private logoutUrl = `${this.tbidApiBaseUrl}/logout`;
38
+ private get loginUrl() {
39
+ return `${this.tbidApiBaseUrl}/dologin?startURL=${encodeURIComponent(
40
+ window.location.href
41
+ )}`;
42
+ }
43
+
44
+ private isLoggedIn = false;
45
+ private userInfo: UserInfo = {};
46
+
47
+ private handleComponentLogoutClick = (event: Event) => {
48
+ event.preventDefault();
49
+ this.trackLogoutClick();
50
+ (
51
+ this.template.querySelector(
52
+ "dx-tbid-avatar-button"
53
+ ) as unknown as TbidAvatarButton
54
+ ).logout();
55
+ };
56
+
57
+ private handleComponentLoginClick = (event: Event) => {
58
+ this.trackLoginClick();
59
+ (
60
+ this.template.querySelector(
61
+ "dx-tbid-avatar-button"
62
+ ) as unknown as TbidAvatarButton
63
+ ).login(event);
64
+ };
65
+
66
+ private handleTbidLoginSuccess = (event: CustomEvent) => {
67
+ event.stopPropagation();
68
+ this.isLoggedIn = true;
69
+
70
+ // Special tracking for this event only
71
+ track(document, "custEv_userLogin", {
72
+ authenticationMethod: "tbid",
73
+ id: {
74
+ tb: Object.entries(this.userInfo)
75
+ .filter(([key]) => trackableUserInfo.has(key))
76
+ .reduce(
77
+ (infoToTrack, [key, value]) => ({
78
+ ...infoToTrack,
79
+ [key]: value
80
+ }),
81
+ {} as Record<string, string>
82
+ )
83
+ }
84
+ });
85
+ };
86
+
87
+ private handleTbidLogoutSuccess = (event: CustomEvent) => {
88
+ event.stopPropagation();
89
+ this.isLoggedIn = false;
90
+ this.userInfo = {};
91
+ };
92
+
93
+ private handleTbidUserInfo = (event: CustomEvent) => {
94
+ event.stopPropagation();
95
+ const { detail } = event;
96
+ if (detail && detail.userInfo) {
97
+ this.userInfo = detail.userInfo;
98
+
99
+ if (!this.isLoggedIn) {
100
+ // If we are not "logged in" but we receive userInfo, it means the user has a valid
101
+ // session cookie that was re-used without login, and we should update the UI to a
102
+ // logged in state.
103
+ this.isLoggedIn = true;
104
+ }
105
+ }
106
+ };
107
+
108
+ private trackLoginClick = () => {
109
+ track(document, "custEv_userLogin", {
110
+ clickText: "Trailblazer.me",
111
+ clickUrl: this.loginUrl,
112
+ itemTitle: "TBID Login Link",
113
+ elementType: "link"
114
+ });
115
+ };
116
+
117
+ private trackLogoutClick = () => {
118
+ track(document, "custEv_userLogout", {
119
+ clickText: "Logout",
120
+ clickUrl: this.logoutUrl,
121
+ itemTitle: "TBID Logout Link",
122
+ elementType: "link"
123
+ });
124
+ };
125
+
126
+ // Shared utility for tracking link clicks.
127
+ private trackMenuClick = (
128
+ target: HTMLAnchorElement | null,
129
+ eventName: string,
130
+ navItemPrefix: string
131
+ ) => {
132
+ const trackingPayload: any = {
133
+ nav_level: "utility",
134
+ nav_type: "global",
135
+ elementType: "link"
136
+ };
137
+
138
+ if (target) {
139
+ trackingPayload.clickText = target.textContent?.trim() || "";
140
+ trackingPayload.clickUrl = target.href;
141
+ const [firstWord, ...remainingText] =
142
+ trackingPayload.clickText.split(" ");
143
+ trackingPayload.nav_item = `${navItemPrefix}${firstWord.toLowerCase()}${remainingText.join()}`;
144
+ }
145
+
146
+ track(target || document, eventName, trackingPayload);
147
+ };
148
+
149
+ // Track link clicks on the "logged out" version of the dropdown.
150
+ private trackLoginMenuClick = (event: Event) => {
151
+ const target = event.currentTarget as HTMLAnchorElement | null;
152
+ this.trackMenuClick(target, "custEv_userLogin", "login:salesforce:");
153
+ };
154
+
155
+ // Track link clicks on the "logged in" version of the dropdown.
156
+ private trackLoggedInMenuClick = (event: Event) => {
157
+ const target = event.currentTarget as HTMLAnchorElement | null;
158
+ this.trackMenuClick(target, "custEv_loginMenuClick", "login:tbid:");
159
+ };
160
+ }
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.