@salesforcedevs/dw-components 0.64.2-alpha.1 → 0.64.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.4",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -22,5 +22,6 @@
|
|
|
22
22
|
"@types/lodash.clonedeep": "^4.5.7",
|
|
23
23
|
"@types/lodash.orderby": "^4.6.7",
|
|
24
24
|
"@types/lodash.uniqby": "^4.7.7"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"gitHead": "bcdf669be371a9413102894f732f5d4727893c37"
|
|
26
27
|
}
|
|
@@ -17,13 +17,6 @@
|
|
|
17
17
|
display: flex;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.filter-checkbox-group,
|
|
21
|
-
.filter-button::part(container) {
|
|
22
|
-
--dx-c-checkbox-text-transform: capitalize;
|
|
23
|
-
|
|
24
|
-
text-transform: var(--dx-c-checkbox-text-transform);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
.docs-action-bar .filters-container > *:not(:first-child),
|
|
28
21
|
.docs-search-input {
|
|
29
22
|
margin-left: var(--dx-g-spacing-sm);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
>
|
|
7
7
|
<slot name="form-heading">
|
|
8
8
|
<h4 class="newsletter-form-heading dx-text-heading-8">
|
|
9
|
-
Sign up now to receive
|
|
9
|
+
Sign up now to receive the newsletter.
|
|
10
10
|
</h4>
|
|
11
11
|
</slot>
|
|
12
12
|
<dx-input
|
|
@@ -52,7 +52,13 @@
|
|
|
52
52
|
required="true"
|
|
53
53
|
></dx-select>
|
|
54
54
|
<template if:true={checkboxTextSet}>
|
|
55
|
-
<
|
|
55
|
+
<template if:true={showMarketingCheckbox}>
|
|
56
|
+
<dx-checkbox
|
|
57
|
+
class="marketing-checkbox"
|
|
58
|
+
value={marketingText}
|
|
59
|
+
label={marketingText}
|
|
60
|
+
></dx-checkbox>
|
|
61
|
+
</template>
|
|
56
62
|
<p class="legal-text" lwc:dom="manual"></p>
|
|
57
63
|
<template if:true={showLegalCheckbox}>
|
|
58
64
|
<dx-checkbox
|
|
@@ -25,6 +25,7 @@ export default class Form extends LightningElement {
|
|
|
25
25
|
|
|
26
26
|
private showLegalText: boolean = false;
|
|
27
27
|
private showLegalCheckbox: boolean = false;
|
|
28
|
+
private showMarketingCheckbox: boolean = false;
|
|
28
29
|
private legalText: string = "";
|
|
29
30
|
private marketingText: string | null = null;
|
|
30
31
|
private hasRendered: boolean = false;
|
|
@@ -80,14 +81,12 @@ export default class Form extends LightningElement {
|
|
|
80
81
|
e.preventDefault();
|
|
81
82
|
|
|
82
83
|
const allFormElements = Array.from(
|
|
83
|
-
this.template.querySelectorAll
|
|
84
|
-
"dx-input, dx-select, dx-checkbox"
|
|
85
|
-
)
|
|
84
|
+
this.template.querySelectorAll("dx-input, dx-select, dx-checkbox")
|
|
86
85
|
);
|
|
87
86
|
|
|
88
87
|
const legalCheckboxElement = this.template.querySelector(
|
|
89
88
|
"dx-checkbox.legal-checkbox"
|
|
90
|
-
)
|
|
89
|
+
);
|
|
91
90
|
|
|
92
91
|
if (legalCheckboxElement) {
|
|
93
92
|
allFormElements.push(legalCheckboxElement);
|
|
@@ -116,13 +115,20 @@ export default class Form extends LightningElement {
|
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
getFormData() {
|
|
118
|
+
const marketingConsented = this.template.querySelector(
|
|
119
|
+
"dx-checkbox.marketing-checkbox"
|
|
120
|
+
)?.checked;
|
|
119
121
|
const date = new Date().toISOString();
|
|
120
122
|
|
|
121
123
|
return {
|
|
122
|
-
InfoEmail: true,
|
|
124
|
+
InfoEmail: marketingConsented ? true : false,
|
|
123
125
|
"First Name": this.firstName,
|
|
124
126
|
"Last Name": this.lastName,
|
|
125
|
-
Consent:
|
|
127
|
+
Consent: marketingConsented
|
|
128
|
+
? "Explicit"
|
|
129
|
+
: this.showMarketingCheckbox
|
|
130
|
+
? ""
|
|
131
|
+
: "Implied",
|
|
126
132
|
"Email Status Update": date,
|
|
127
133
|
email: this.email,
|
|
128
134
|
Country: this.country,
|
|
@@ -134,9 +140,7 @@ export default class Form extends LightningElement {
|
|
|
134
140
|
async sendFormData() {
|
|
135
141
|
const formData = this.getFormData();
|
|
136
142
|
const errorMsg = "Error while subscribing to newsletter";
|
|
137
|
-
const submitButtonEl = this.template.querySelector(
|
|
138
|
-
".form-submit"
|
|
139
|
-
) as HTMLFormElement;
|
|
143
|
+
const submitButtonEl = this.template.querySelector(".form-submit");
|
|
140
144
|
|
|
141
145
|
submitButtonEl.setAttribute("disabled", "true");
|
|
142
146
|
submitButtonEl.textContent = "...Processing request";
|
|
@@ -165,10 +169,8 @@ export default class Form extends LightningElement {
|
|
|
165
169
|
|
|
166
170
|
window.location.assign("/newsletter/success");
|
|
167
171
|
} catch (error) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
submitButtonEl.textContent = "Subscribe Now";
|
|
171
|
-
}
|
|
172
|
+
submitButtonEl.setAttribute("disabled", "false");
|
|
173
|
+
submitButtonEl.textContent = "Subscribe Now";
|
|
172
174
|
console.error(error);
|
|
173
175
|
}
|
|
174
176
|
}
|
|
@@ -176,7 +178,7 @@ export default class Form extends LightningElement {
|
|
|
176
178
|
handleConsent(countrySelectElement: any) {
|
|
177
179
|
if (this.checkboxTextSet) {
|
|
178
180
|
const countryOptions = countrySelectElement.options.find(
|
|
179
|
-
(option
|
|
181
|
+
(option) => option.value === countrySelectElement.value
|
|
180
182
|
);
|
|
181
183
|
|
|
182
184
|
this.setLegalAndMarketingData(countryOptions);
|
|
@@ -198,7 +200,8 @@ export default class Form extends LightningElement {
|
|
|
198
200
|
// Toggle visibility of legal/marketing data
|
|
199
201
|
this.toggleLegalAndMarketingVisibility(
|
|
200
202
|
countryOptions.showLegalText,
|
|
201
|
-
countryOptions.showLegalCheckbox
|
|
203
|
+
countryOptions.showLegalCheckbox,
|
|
204
|
+
countryOptions.showMarketingCheckbox
|
|
202
205
|
);
|
|
203
206
|
|
|
204
207
|
// Grab the legal text paragraph element and set inner html (this is due to text having html elements in the string)
|
|
@@ -219,10 +222,12 @@ export default class Form extends LightningElement {
|
|
|
219
222
|
|
|
220
223
|
toggleLegalAndMarketingVisibility(
|
|
221
224
|
showLegalText: boolean,
|
|
222
|
-
showLegalCheckbox: boolean
|
|
225
|
+
showLegalCheckbox: boolean,
|
|
226
|
+
showMarketingCheckbox: boolean
|
|
223
227
|
) {
|
|
224
228
|
this.showLegalText = showLegalText;
|
|
225
229
|
this.showLegalCheckbox = showLegalCheckbox;
|
|
230
|
+
this.showMarketingCheckbox = showMarketingCheckbox;
|
|
226
231
|
}
|
|
227
232
|
|
|
228
233
|
setInnerHtml(element: HTMLElement, value: string) {
|