@salesforcedevs/dw-components 1.3.30 → 1.3.33-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/dw-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.33-alpha.0",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -23,6 +23,5 @@
|
|
|
23
23
|
"@types/lodash.uniqby": "^4.7.7",
|
|
24
24
|
"@types/setimmediate": "^1.0.2",
|
|
25
25
|
"setimmediate": "^1.0.5"
|
|
26
|
-
}
|
|
27
|
-
"gitHead": "3c3228df779a7ca7a69125ef45aa05e8bff371dc"
|
|
26
|
+
}
|
|
28
27
|
}
|
|
@@ -25,8 +25,7 @@ span {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
dx-checkbox,
|
|
28
|
-
|
|
29
|
-
width: 100%;
|
|
28
|
+
:not(dx-checkbox) > span {
|
|
30
29
|
margin-bottom: var(--dx-g-spacing-lg);
|
|
31
30
|
}
|
|
32
31
|
|
|
@@ -49,6 +48,10 @@ form > .full-name-field {
|
|
|
49
48
|
width: calc(50% - var(--dx-g-spacing-lg) / 2);
|
|
50
49
|
}
|
|
51
50
|
|
|
51
|
+
.legal-terms {
|
|
52
|
+
margin-top: var(--dx-g-spacing-lg);
|
|
53
|
+
}
|
|
54
|
+
|
|
52
55
|
.submit-button {
|
|
53
56
|
width: 100%;
|
|
54
57
|
}
|
|
@@ -70,32 +70,39 @@
|
|
|
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="jane@company.sandbox"
|
|
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>
|
|
82
79
|
<dx-checkbox
|
|
83
|
-
if:true={
|
|
80
|
+
if:true={showMarketingField}
|
|
84
81
|
name="opt_in"
|
|
85
82
|
value="explicit"
|
|
86
83
|
>
|
|
87
84
|
<span lwc:dom="manual" class="marketing-terms"></span>
|
|
88
85
|
</dx-checkbox>
|
|
89
86
|
<dx-checkbox
|
|
90
|
-
if:true={
|
|
87
|
+
if:true={showLegalCheckbox}
|
|
91
88
|
required
|
|
92
|
-
name="
|
|
93
|
-
value="
|
|
89
|
+
name="eula"
|
|
90
|
+
value="accepted"
|
|
94
91
|
>
|
|
95
|
-
<span lwc:dom="manual" class="
|
|
92
|
+
<span lwc:dom="manual" class="legal-terms"></span>
|
|
93
|
+
<span
|
|
94
|
+
if:true={learnMore}
|
|
95
|
+
lwc:dom="manual"
|
|
96
|
+
class="learn-more"
|
|
97
|
+
></span>
|
|
96
98
|
</dx-checkbox>
|
|
97
|
-
<template if:false={
|
|
98
|
-
<span lwc:dom="manual" class="
|
|
99
|
+
<template if:false={showLegalCheckbox}>
|
|
100
|
+
<span lwc:dom="manual" class="legal-terms"></span>
|
|
101
|
+
<span
|
|
102
|
+
if:true={learnMore}
|
|
103
|
+
lwc:dom="manual"
|
|
104
|
+
class="learn-more"
|
|
105
|
+
></span>
|
|
99
106
|
</template>
|
|
100
107
|
<dx-button
|
|
101
108
|
class="submit-button"
|
|
@@ -11,14 +11,24 @@ import {
|
|
|
11
11
|
|
|
12
12
|
type SelectOption = { value: string; label: string };
|
|
13
13
|
type Country = SelectOption & {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
showMarketingField: boolean;
|
|
15
|
+
showLegalCheckbox: boolean;
|
|
16
|
+
checkboxTextSet?: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type CheckboxSet = {
|
|
20
|
+
marketingText: string;
|
|
21
|
+
legalText: string;
|
|
22
|
+
learnMore?: string;
|
|
23
|
+
};
|
|
24
|
+
type CheckboxTextMap = {
|
|
25
|
+
[key: string]: CheckboxSet;
|
|
17
26
|
};
|
|
18
27
|
|
|
19
28
|
const DEFAULT_DRIVER = "7013000000005wb";
|
|
20
29
|
const DUPLICATE_USERNAME_MESSAGE =
|
|
21
30
|
"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";
|
|
22
32
|
const SIGN_UP_LABEL = "Sign me Up";
|
|
23
33
|
|
|
24
34
|
const ANALYTICS_INFO = {
|
|
@@ -52,14 +62,20 @@ export default class DeSignupForm extends LightningElement {
|
|
|
52
62
|
this._roles = toJson(value);
|
|
53
63
|
}
|
|
54
64
|
|
|
55
|
-
@api
|
|
56
|
-
|
|
57
|
-
|
|
65
|
+
@api
|
|
66
|
+
get checkboxTextMap() {
|
|
67
|
+
return this._checkboxTextMap;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
set checkboxTextMap(value) {
|
|
71
|
+
this._checkboxTextMap = toJson(value);
|
|
72
|
+
}
|
|
58
73
|
|
|
59
74
|
private country: Country = null;
|
|
60
75
|
private disableSubmit = false;
|
|
61
76
|
private username = "";
|
|
62
77
|
private updateCheckboxLabels = true;
|
|
78
|
+
private _checkboxTextMap: CheckboxTextMap = null;
|
|
63
79
|
private _countries: Array<Country>;
|
|
64
80
|
private _roles: Array<SelectOption>;
|
|
65
81
|
@track knownDuplicateUsers = [];
|
|
@@ -74,12 +90,35 @@ export default class DeSignupForm extends LightningElement {
|
|
|
74
90
|
return !this.knownDuplicateUsers.includes(this.username);
|
|
75
91
|
}
|
|
76
92
|
|
|
77
|
-
get
|
|
78
|
-
return this.country && this.country.
|
|
93
|
+
get showMarketingField(): boolean {
|
|
94
|
+
return this.country && this.country.showMarketingField;
|
|
79
95
|
}
|
|
80
96
|
|
|
81
|
-
get
|
|
82
|
-
return
|
|
97
|
+
get marketingText(): string {
|
|
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
|
+
);
|
|
83
122
|
}
|
|
84
123
|
|
|
85
124
|
get buttonLabel(): string {
|
|
@@ -96,11 +135,12 @@ export default class DeSignupForm extends LightningElement {
|
|
|
96
135
|
this.updateInnerHtml(
|
|
97
136
|
"span.marketing-terms",
|
|
98
137
|
this.marketingText,
|
|
99
|
-
this.
|
|
138
|
+
this.showMarketingField
|
|
100
139
|
) ||
|
|
101
140
|
this.updateInnerHtml(
|
|
102
|
-
"span.
|
|
103
|
-
this.
|
|
141
|
+
"span.learn-more",
|
|
142
|
+
this.learnMore,
|
|
143
|
+
!!this.learnMore
|
|
104
144
|
);
|
|
105
145
|
}
|
|
106
146
|
|
|
@@ -178,19 +218,18 @@ export default class DeSignupForm extends LightningElement {
|
|
|
178
218
|
userData[field.name] = field.value;
|
|
179
219
|
});
|
|
180
220
|
|
|
181
|
-
(userData as UserData).opt_in = this.country.
|
|
221
|
+
(userData as UserData).opt_in = this.country.showMarketingField
|
|
182
222
|
? checkboxes.values.opt_in
|
|
183
223
|
: "implied";
|
|
184
224
|
|
|
185
225
|
const InfoEmail__c =
|
|
186
|
-
this.country.
|
|
187
|
-
checkboxes.values.opt_in === ""
|
|
226
|
+
this.country.showMarketingField && checkboxes.values.opt_in === ""
|
|
188
227
|
? "False"
|
|
189
228
|
: "True";
|
|
190
229
|
|
|
191
230
|
const formData: SignupForm = {
|
|
192
231
|
user: userData as UserData,
|
|
193
|
-
eula: checkboxes.values.eula,
|
|
232
|
+
eula: this.showLegalCheckbox ? checkboxes.values.eula : ACCEPTED,
|
|
194
233
|
default_driver: DEFAULT_DRIVER,
|
|
195
234
|
InfoEmail__c
|
|
196
235
|
};
|
|
@@ -13,6 +13,7 @@ const ANALYTICS_INFO = {
|
|
|
13
13
|
elementType: "button",
|
|
14
14
|
ctaClick: true
|
|
15
15
|
};
|
|
16
|
+
const LOCAL_STORAGE_KEY = "subscriberEmail";
|
|
16
17
|
|
|
17
18
|
export default class Form extends LightningElement {
|
|
18
19
|
@api checkboxTextSet: string = "";
|
|
@@ -104,14 +105,12 @@ export default class Form extends LightningElement {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
setInitialEmail() {
|
|
107
|
-
// Set email if provided in the
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const subscriberEmail = urlParams.get("subscriberEmail");
|
|
112
|
-
|
|
108
|
+
// Set email if provided in the local storage
|
|
109
|
+
const subscriberEmail = window.localStorage.getItem(LOCAL_STORAGE_KEY);
|
|
110
|
+
console.log("subscriberEmail > " , subscriberEmail);
|
|
113
111
|
if (subscriberEmail) {
|
|
114
112
|
this.email = subscriberEmail;
|
|
113
|
+
window.localStorage.removeItem(LOCAL_STORAGE_KEY);
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
116
|
|
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.
|