@salesforcedevs/dw-components 1.2.17-canary.1 → 1.2.20-lightdom-6
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 +2 -2
- package/package.json +1 -1
- package/src/modules/dw/deSignupForm/deSignupForm.ts +6 -5
- package/src/modules/dw/eventsList/eventsList.ts +1 -8
- package/src/modules/dw/getStarted/getStarted.css +44 -0
- package/src/modules/dw/getStarted/getStarted.html +15 -0
- package/src/modules/dw/getStarted/getStarted.ts +26 -0
- package/src/modules/dw/slackCta/slackCta.html +1 -1
- package/src/modules/dw/slackCta/slackCta.ts +2 -0
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.css +0 -119
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.html +0 -192
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.ts +0 -165
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,7 +21,6 @@
|
|
|
20
21
|
"dw/podcastsPromo",
|
|
21
22
|
"dw/rcgTable",
|
|
22
23
|
"dw/slackCta",
|
|
23
|
-
"dw/slackSuccess"
|
|
24
|
-
"dw/tbidLoginMenu"
|
|
24
|
+
"dw/slackSuccess"
|
|
25
25
|
]
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -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
|
|
230
|
-
? checkboxes.values.eula === ACCEPTED
|
|
231
|
-
? "True"
|
|
232
|
-
: "False"
|
|
233
|
-
: "True"
|
|
234
|
+
InfoEmail__c
|
|
234
235
|
};
|
|
235
236
|
|
|
236
237
|
return formData;
|
|
@@ -56,14 +56,7 @@ export default abstract class EventsList extends LightningElement {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
set events(value) {
|
|
59
|
-
|
|
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
|
|
|
@@ -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
|
+
}
|
|
@@ -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
|
|
|
@@ -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
|
-
}
|