@salesforcedevs/dw-components 1.3.25 → 1.3.27
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/dw-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.27",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"@types/lodash.orderby": "^4.6.7",
|
|
23
23
|
"@types/lodash.uniqby": "^4.7.7"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "50fad887e4e8cabd07608a64e55d41d69ece640a"
|
|
26
26
|
}
|
|
@@ -25,7 +25,8 @@ span {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
dx-checkbox,
|
|
28
|
-
|
|
28
|
+
.privacy-notice {
|
|
29
|
+
width: 100%;
|
|
29
30
|
margin-bottom: var(--dx-g-spacing-lg);
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -48,10 +49,6 @@ form > .full-name-field {
|
|
|
48
49
|
width: calc(50% - var(--dx-g-spacing-lg) / 2);
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
.legal-terms {
|
|
52
|
-
margin-top: var(--dx-g-spacing-lg);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
52
|
.submit-button {
|
|
56
53
|
width: 100%;
|
|
57
54
|
}
|
|
@@ -70,39 +70,32 @@
|
|
|
70
70
|
description-markup='Your username must be in the form of an email address (it does not have to be real). It must be unique and cannot be associated with another Salesforce login credential. <a href="https://help.salesforce.com/s/articleView?id=sf.basics_intro_usernames_passwords.htm&type=5" target="_blank">Read more about username recommendations.</a>'
|
|
71
71
|
label="Username"
|
|
72
72
|
name="username"
|
|
73
|
-
placeholder="
|
|
73
|
+
placeholder="miles.vandewetering@salesforce.com"
|
|
74
74
|
required
|
|
75
75
|
type="email"
|
|
76
76
|
validity-on-blur={checkUsernameValidity}
|
|
77
77
|
onchange={handleUsernameChange}
|
|
78
78
|
></dx-input>
|
|
79
|
+
<dx-checkbox required name="eula" value="accepted">
|
|
80
|
+
<span lwc:dom="manual" class="legal-terms"></span>
|
|
81
|
+
</dx-checkbox>
|
|
79
82
|
<dx-checkbox
|
|
80
|
-
if:true={
|
|
83
|
+
if:true={showMarketingCheckbox}
|
|
81
84
|
name="opt_in"
|
|
82
85
|
value="explicit"
|
|
83
86
|
>
|
|
84
87
|
<span lwc:dom="manual" class="marketing-terms"></span>
|
|
85
88
|
</dx-checkbox>
|
|
86
89
|
<dx-checkbox
|
|
87
|
-
if:true={
|
|
90
|
+
if:true={showPrivacyCheckbox}
|
|
88
91
|
required
|
|
89
|
-
name="
|
|
90
|
-
value="
|
|
92
|
+
name="privacy"
|
|
93
|
+
value="privacy_accepted"
|
|
91
94
|
>
|
|
92
|
-
<span lwc:dom="manual" class="
|
|
93
|
-
<span
|
|
94
|
-
if:true={learnMore}
|
|
95
|
-
lwc:dom="manual"
|
|
96
|
-
class="learn-more"
|
|
97
|
-
></span>
|
|
95
|
+
<span lwc:dom="manual" class="privacy-terms"></span>
|
|
98
96
|
</dx-checkbox>
|
|
99
|
-
<template if:false={
|
|
100
|
-
<span lwc:dom="manual" class="
|
|
101
|
-
<span
|
|
102
|
-
if:true={learnMore}
|
|
103
|
-
lwc:dom="manual"
|
|
104
|
-
class="learn-more"
|
|
105
|
-
></span>
|
|
97
|
+
<template if:false={showPrivacyCheckbox}>
|
|
98
|
+
<span lwc:dom="manual" class="privacy-terms privacy-notice"></span>
|
|
106
99
|
</template>
|
|
107
100
|
<dx-button
|
|
108
101
|
class="submit-button"
|
|
@@ -11,24 +11,14 @@ import {
|
|
|
11
11
|
|
|
12
12
|
type SelectOption = { value: string; label: string };
|
|
13
13
|
type Country = SelectOption & {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
type CheckboxSet = {
|
|
20
|
-
marketingText: string;
|
|
21
|
-
legalText: string;
|
|
22
|
-
learnMore?: string;
|
|
23
|
-
};
|
|
24
|
-
type CheckboxTextMap = {
|
|
25
|
-
[key: string]: CheckboxSet;
|
|
14
|
+
showMarketingCheckbox: boolean;
|
|
15
|
+
privacyText?: string;
|
|
16
|
+
privacyOptIn?: boolean;
|
|
26
17
|
};
|
|
27
18
|
|
|
28
19
|
const DEFAULT_DRIVER = "7013000000005wb";
|
|
29
20
|
const DUPLICATE_USERNAME_MESSAGE =
|
|
30
21
|
"You are already using that username in another Salesforce login credential. Your username needs to be unique and in the form of an email address.";
|
|
31
|
-
const ACCEPTED = "accepted";
|
|
32
22
|
const SIGN_UP_LABEL = "Sign me Up";
|
|
33
23
|
|
|
34
24
|
const ANALYTICS_INFO = {
|
|
@@ -62,20 +52,14 @@ export default class DeSignupForm extends LightningElement {
|
|
|
62
52
|
this._roles = toJson(value);
|
|
63
53
|
}
|
|
64
54
|
|
|
65
|
-
@api
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
set checkboxTextMap(value) {
|
|
71
|
-
this._checkboxTextMap = toJson(value);
|
|
72
|
-
}
|
|
55
|
+
@api marketingText: string = "";
|
|
56
|
+
@api privacyText: string = "";
|
|
57
|
+
@api legalText: string = "";
|
|
73
58
|
|
|
74
59
|
private country: Country = null;
|
|
75
60
|
private disableSubmit = false;
|
|
76
61
|
private username = "";
|
|
77
62
|
private updateCheckboxLabels = true;
|
|
78
|
-
private _checkboxTextMap: CheckboxTextMap = null;
|
|
79
63
|
private _countries: Array<Country>;
|
|
80
64
|
private _roles: Array<SelectOption>;
|
|
81
65
|
@track knownDuplicateUsers = [];
|
|
@@ -90,35 +74,12 @@ export default class DeSignupForm extends LightningElement {
|
|
|
90
74
|
return !this.knownDuplicateUsers.includes(this.username);
|
|
91
75
|
}
|
|
92
76
|
|
|
93
|
-
get
|
|
94
|
-
return this.country && this.country.
|
|
77
|
+
get showMarketingCheckbox(): boolean {
|
|
78
|
+
return this.country && this.country.showMarketingCheckbox;
|
|
95
79
|
}
|
|
96
80
|
|
|
97
|
-
get
|
|
98
|
-
return
|
|
99
|
-
this.checkboxSetByCountry && this.checkboxSetByCountry.marketingText
|
|
100
|
-
);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
get showLegalCheckbox(): boolean {
|
|
104
|
-
return this.country && this.country.showLegalCheckbox;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
get legalText(): string {
|
|
108
|
-
return this.checkboxSetByCountry && this.checkboxSetByCountry.legalText;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
get learnMore(): string | undefined {
|
|
112
|
-
return this.checkboxSetByCountry && this.checkboxSetByCountry.learnMore;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
get checkboxSetByCountry(): CheckboxSet {
|
|
116
|
-
return (
|
|
117
|
-
(this.country &&
|
|
118
|
-
this.country.checkboxTextSet &&
|
|
119
|
-
this.checkboxTextMap[this.country.checkboxTextSet]) ||
|
|
120
|
-
this.checkboxTextMap.default
|
|
121
|
-
);
|
|
81
|
+
get showPrivacyCheckbox(): boolean {
|
|
82
|
+
return this.country && !!this.country.privacyOptIn;
|
|
122
83
|
}
|
|
123
84
|
|
|
124
85
|
get buttonLabel(): string {
|
|
@@ -135,12 +96,11 @@ export default class DeSignupForm extends LightningElement {
|
|
|
135
96
|
this.updateInnerHtml(
|
|
136
97
|
"span.marketing-terms",
|
|
137
98
|
this.marketingText,
|
|
138
|
-
this.
|
|
99
|
+
this.showMarketingCheckbox
|
|
139
100
|
) ||
|
|
140
101
|
this.updateInnerHtml(
|
|
141
|
-
"span.
|
|
142
|
-
this.
|
|
143
|
-
!!this.learnMore
|
|
102
|
+
"span.privacy-terms",
|
|
103
|
+
this.country?.privacyText || this.privacyText
|
|
144
104
|
);
|
|
145
105
|
}
|
|
146
106
|
|
|
@@ -218,18 +178,19 @@ export default class DeSignupForm extends LightningElement {
|
|
|
218
178
|
userData[field.name] = field.value;
|
|
219
179
|
});
|
|
220
180
|
|
|
221
|
-
(userData as UserData).opt_in = this.country.
|
|
181
|
+
(userData as UserData).opt_in = this.country.showMarketingCheckbox
|
|
222
182
|
? checkboxes.values.opt_in
|
|
223
183
|
: "implied";
|
|
224
184
|
|
|
225
185
|
const InfoEmail__c =
|
|
226
|
-
this.country.
|
|
186
|
+
this.country.showMarketingCheckbox &&
|
|
187
|
+
checkboxes.values.opt_in === ""
|
|
227
188
|
? "False"
|
|
228
189
|
: "True";
|
|
229
190
|
|
|
230
191
|
const formData: SignupForm = {
|
|
231
192
|
user: userData as UserData,
|
|
232
|
-
eula:
|
|
193
|
+
eula: checkboxes.values.eula,
|
|
233
194
|
default_driver: DEFAULT_DRIVER,
|
|
234
195
|
InfoEmail__c
|
|
235
196
|
};
|
|
@@ -1,24 +1,11 @@
|
|
|
1
1
|
import { api, LightningElement } from "lwc";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
2
3
|
import { toJson } from "dxUtils/normalizers";
|
|
4
|
+
import { convertForDaylightSavings } from "dxUtils/dates";
|
|
3
5
|
import qs from "query-string";
|
|
4
6
|
import uniqBy from "lodash.uniqby";
|
|
5
7
|
import orderBy from "lodash.orderby";
|
|
6
8
|
|
|
7
|
-
const MONTH_NAMES = [
|
|
8
|
-
"January",
|
|
9
|
-
"February",
|
|
10
|
-
"March",
|
|
11
|
-
"April",
|
|
12
|
-
"May",
|
|
13
|
-
"June",
|
|
14
|
-
"July",
|
|
15
|
-
"August",
|
|
16
|
-
"September",
|
|
17
|
-
"October",
|
|
18
|
-
"November",
|
|
19
|
-
"December"
|
|
20
|
-
];
|
|
21
|
-
|
|
22
9
|
export default abstract class EventsList extends LightningElement {
|
|
23
10
|
private _events: any[] = [];
|
|
24
11
|
private monthsList: any[] = [];
|
|
@@ -31,11 +18,11 @@ export default abstract class EventsList extends LightningElement {
|
|
|
31
18
|
return (
|
|
32
19
|
this._events
|
|
33
20
|
.filter((event) => {
|
|
34
|
-
const date =
|
|
35
|
-
const eventDate = `${MONTH_NAMES[date.getUTCMonth()]}`;
|
|
21
|
+
const date = DateTime.fromISO(event.startDate);
|
|
36
22
|
return (
|
|
37
|
-
this.selectedMonths.includes(
|
|
38
|
-
|
|
23
|
+
this.selectedMonths.includes(
|
|
24
|
+
date.toFormat("LLLL yyyy")
|
|
25
|
+
) && this.selectedEventTypes.includes(event.type)
|
|
39
26
|
);
|
|
40
27
|
})
|
|
41
28
|
// some url stubs don't have /events/ prepended to the url
|
|
@@ -61,17 +48,31 @@ export default abstract class EventsList extends LightningElement {
|
|
|
61
48
|
}
|
|
62
49
|
|
|
63
50
|
get upcomingEvents() {
|
|
64
|
-
const today =
|
|
65
|
-
|
|
51
|
+
const today = DateTime.local().toISO();
|
|
52
|
+
const test = this._filteredEvents.filter((event) => {
|
|
53
|
+
return (
|
|
54
|
+
convertForDaylightSavings(event.endDate) >=
|
|
55
|
+
DateTime.fromISO(today)
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return test;
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
get pastEvents() {
|
|
69
|
-
const today =
|
|
70
|
-
|
|
71
|
-
this._filteredEvents.filter((event) =>
|
|
72
|
-
|
|
63
|
+
const today = DateTime.local().toISO();
|
|
64
|
+
const test = orderBy(
|
|
65
|
+
this._filteredEvents.filter((event) => {
|
|
66
|
+
return (
|
|
67
|
+
convertForDaylightSavings(event.endDate) <=
|
|
68
|
+
DateTime.fromISO(today)
|
|
69
|
+
);
|
|
70
|
+
}),
|
|
71
|
+
["endDate"],
|
|
73
72
|
["desc"]
|
|
74
73
|
);
|
|
74
|
+
|
|
75
|
+
return test;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
get shownEventsTotal() {
|
|
@@ -95,15 +96,19 @@ export default abstract class EventsList extends LightningElement {
|
|
|
95
96
|
window.removeEventListener("popstate", this.handleURLStateChange);
|
|
96
97
|
}
|
|
97
98
|
|
|
99
|
+
convertForDaylightSavings(date: string) {
|
|
100
|
+
return DateTime.fromISO(date).isInDST
|
|
101
|
+
? DateTime.fromISO(date).toLocal()
|
|
102
|
+
: DateTime.fromISO(date).toLocal().plus({ hour: 1 });
|
|
103
|
+
}
|
|
104
|
+
|
|
98
105
|
createMonthsList() {
|
|
99
106
|
return this._events.map((event) => {
|
|
100
|
-
const date =
|
|
107
|
+
const date = DateTime.fromISO(event.startDate);
|
|
101
108
|
return {
|
|
102
109
|
rawDate: date,
|
|
103
|
-
value:
|
|
104
|
-
label:
|
|
105
|
-
MONTH_NAMES[date.getUTCMonth()]
|
|
106
|
-
} ${date.getUTCFullYear()}`
|
|
110
|
+
value: date.toFormat("LLLL yyyy"),
|
|
111
|
+
label: date.toFormat("LLLL yyyy")
|
|
107
112
|
};
|
|
108
113
|
});
|
|
109
114
|
}
|