@salesforcedevs/dw-components 1.3.105-alpha.0 → 1.3.109
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 +2 -2
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +0 -1
- package/src/modules/dw/deSignupForm/deSignupForm.css +1 -3
- package/src/modules/dw/deSignupForm/deSignupForm.html +15 -24
- package/src/modules/dw/deSignupForm/deSignupForm.ts +53 -89
- package/src/modules/dw/deSignupForm/submitForm.ts +1 -0
- package/src/modules/dw/docsGrid/docsGrid.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dw-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.109",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@types/setimmediate": "^1.0.2",
|
|
25
25
|
"setimmediate": "^1.0.5"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "bd688e3e86b4d0d9d58765892bbffeec9dce2a1a"
|
|
28
28
|
}
|
|
@@ -118,7 +118,6 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
118
118
|
this.selectedProductFilter?.forEach((filter) => {
|
|
119
119
|
track(document, "custEv_filterAbandoned", {
|
|
120
120
|
click_text: filter,
|
|
121
|
-
click_url: filter,
|
|
122
121
|
element_title: "CodeSamplesGrid",
|
|
123
122
|
element_type: "filter abandoned",
|
|
124
123
|
content_category: "filter"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
placeholder="Select Country/Region"
|
|
53
53
|
required
|
|
54
54
|
value=""
|
|
55
|
-
onchange={
|
|
55
|
+
onchange={handleCountryChange}
|
|
56
56
|
></dx-select>
|
|
57
57
|
<dx-input
|
|
58
58
|
label="Postal Code"
|
|
@@ -80,33 +80,24 @@
|
|
|
80
80
|
<dx-checkbox required name="eula" value="accepted">
|
|
81
81
|
<span lwc:dom="manual" class="legal-terms"></span>
|
|
82
82
|
</dx-checkbox>
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
<dx-checkbox
|
|
84
|
+
if:true={showMarketingCheckbox}
|
|
85
|
+
name="opt_in"
|
|
86
|
+
value="False"
|
|
87
|
+
>
|
|
85
88
|
<span lwc:dom="manual" class="marketing-terms"></span>
|
|
86
|
-
</
|
|
87
|
-
<template if:true={showMarketingCheckbox}>
|
|
88
|
-
<dx-checkbox
|
|
89
|
-
name="marketingCheckbox"
|
|
90
|
-
class="marketing-terms"
|
|
91
|
-
value="false"
|
|
92
|
-
onchange={handleMarketingCheckbox}
|
|
93
|
-
>
|
|
94
|
-
<span>{marketingText}</span>
|
|
95
|
-
</dx-checkbox>
|
|
96
|
-
</template>
|
|
97
|
-
|
|
98
|
-
<template if:false={showLegalCheckbox}>
|
|
99
|
-
<span lwc:dom="manual" class="legal-checkbox privacy-terms"></span>
|
|
100
|
-
</template>
|
|
89
|
+
</dx-checkbox>
|
|
101
90
|
<dx-checkbox
|
|
102
|
-
if:true={
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
if:true={showPrivacyCheckbox}
|
|
92
|
+
required
|
|
93
|
+
name="privacy"
|
|
94
|
+
value="privacy_accepted"
|
|
106
95
|
>
|
|
107
|
-
<span lwc:dom="manual" class="
|
|
96
|
+
<span lwc:dom="manual" class="privacy-terms"></span>
|
|
108
97
|
</dx-checkbox>
|
|
109
|
-
|
|
98
|
+
<template if:false={showPrivacyCheckbox}>
|
|
99
|
+
<span lwc:dom="manual" class="privacy-terms privacy-notice"></span>
|
|
100
|
+
</template>
|
|
110
101
|
<dx-button
|
|
111
102
|
class="submit-button"
|
|
112
103
|
disabled={disableSubmit}
|
|
@@ -2,7 +2,6 @@ import { LightningElement, api, track } from "lwc";
|
|
|
2
2
|
import { toJson } from "dxUtils/normalizers";
|
|
3
3
|
import { track as trackGtm } from "dxUtils/analytics";
|
|
4
4
|
import { submitForm, ErrorCode, SignupForm, UserData } from "./submitForm";
|
|
5
|
-
import { CountryOptions } from "typings/custom";
|
|
6
5
|
|
|
7
6
|
type SelectOption = { value: string; label: string };
|
|
8
7
|
type Country = SelectOption & {
|
|
@@ -35,21 +34,16 @@ export default class DeSignupForm extends LightningElement {
|
|
|
35
34
|
this._roles = toJson(value);
|
|
36
35
|
}
|
|
37
36
|
|
|
37
|
+
@api marketingText: string = "";
|
|
38
|
+
@api privacyText: string = "";
|
|
38
39
|
@api legalText: string = "";
|
|
39
|
-
@api drmDomain: string = "https://drm.my.salesforce-sites.com";
|
|
40
40
|
|
|
41
41
|
private country: Country = null;
|
|
42
42
|
private disableSubmit = false;
|
|
43
43
|
private username = "";
|
|
44
|
-
private
|
|
44
|
+
private updateCheckboxLabels = true;
|
|
45
|
+
private _countries: Array<Country>;
|
|
45
46
|
private _roles: Array<SelectOption>;
|
|
46
|
-
private showMarketingCheckbox: boolean = false;
|
|
47
|
-
private marketingCheckbox: boolean = false;
|
|
48
|
-
private marketingText: string = "";
|
|
49
|
-
private showLegalCheckbox: boolean = false;
|
|
50
|
-
private privacyText: string = "";
|
|
51
|
-
private hasRendered = false;
|
|
52
|
-
|
|
53
47
|
@track knownDuplicateUsers = [];
|
|
54
48
|
|
|
55
49
|
get usernameError(): string {
|
|
@@ -62,6 +56,10 @@ export default class DeSignupForm extends LightningElement {
|
|
|
62
56
|
return !this.knownDuplicateUsers.includes(this.username);
|
|
63
57
|
}
|
|
64
58
|
|
|
59
|
+
get showMarketingCheckbox(): boolean {
|
|
60
|
+
return this.country && this.country.showMarketingCheckbox;
|
|
61
|
+
}
|
|
62
|
+
|
|
65
63
|
get showPrivacyCheckbox(): boolean {
|
|
66
64
|
return this.country && !!this.country.privacyOptIn;
|
|
67
65
|
}
|
|
@@ -70,18 +68,22 @@ export default class DeSignupForm extends LightningElement {
|
|
|
70
68
|
return this.disableSubmit ? "Beep boop processing" : SIGN_UP_LABEL;
|
|
71
69
|
}
|
|
72
70
|
|
|
73
|
-
connectedCallback(): void {
|
|
74
|
-
this.getCountryList();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
71
|
renderedCallback(): void {
|
|
78
|
-
if (!this.
|
|
79
|
-
this.hasRendered = true;
|
|
72
|
+
if (!this.updateCheckboxLabels) {
|
|
80
73
|
return;
|
|
81
74
|
}
|
|
82
|
-
|
|
83
|
-
this.
|
|
84
|
-
|
|
75
|
+
|
|
76
|
+
this.updateCheckboxLabels =
|
|
77
|
+
this.updateInnerHtml("span.legal-terms", this.legalText) ||
|
|
78
|
+
this.updateInnerHtml(
|
|
79
|
+
"span.marketing-terms",
|
|
80
|
+
this.marketingText,
|
|
81
|
+
this.showMarketingCheckbox
|
|
82
|
+
) ||
|
|
83
|
+
this.updateInnerHtml(
|
|
84
|
+
"span.privacy-terms",
|
|
85
|
+
this.country?.privacyText || this.privacyText
|
|
86
|
+
);
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
handleSubmit(event: Event): void {
|
|
@@ -113,8 +115,7 @@ export default class DeSignupForm extends LightningElement {
|
|
|
113
115
|
"https://developer.salesforce.com/signup/success",
|
|
114
116
|
form_country: formData.user.country,
|
|
115
117
|
form_name: "Dev Edition Signup",
|
|
116
|
-
form_primary_product_interest: "Developer Edition"
|
|
117
|
-
offer_type: "free trial"
|
|
118
|
+
form_primary_product_interest: "Developer Edition"
|
|
118
119
|
});
|
|
119
120
|
window.location.href = "/signup/success";
|
|
120
121
|
})
|
|
@@ -139,6 +140,13 @@ export default class DeSignupForm extends LightningElement {
|
|
|
139
140
|
this.username = event.detail;
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
handleCountryChange(event: CustomEvent<{ value: string }>): void {
|
|
144
|
+
this.country = this.countries.find(
|
|
145
|
+
({ value }) => value === event.detail.value
|
|
146
|
+
);
|
|
147
|
+
this.updateCheckboxLabels = true;
|
|
148
|
+
}
|
|
149
|
+
|
|
142
150
|
private prepareUserData(): SignupForm | null {
|
|
143
151
|
const fields = Array.from(
|
|
144
152
|
this.template.querySelectorAll<HTMLFormElement>(
|
|
@@ -150,7 +158,9 @@ export default class DeSignupForm extends LightningElement {
|
|
|
150
158
|
value: element.value
|
|
151
159
|
}));
|
|
152
160
|
|
|
153
|
-
|
|
161
|
+
const checkboxes = this.getCheckboxesResult();
|
|
162
|
+
|
|
163
|
+
if (fields.some((field) => !field.valid) || !checkboxes.valid) {
|
|
154
164
|
return null;
|
|
155
165
|
}
|
|
156
166
|
|
|
@@ -159,15 +169,17 @@ export default class DeSignupForm extends LightningElement {
|
|
|
159
169
|
userData[field.name] = field.value;
|
|
160
170
|
});
|
|
161
171
|
|
|
162
|
-
(userData as UserData).consent = this.showMarketingCheckbox
|
|
172
|
+
(userData as UserData).consent = this.country.showMarketingCheckbox
|
|
163
173
|
? "Explicit"
|
|
164
|
-
: "Implied";
|
|
174
|
+
: "Implied ";
|
|
165
175
|
const InfoEmail =
|
|
166
|
-
this.showMarketingCheckbox && !
|
|
176
|
+
this.country.showMarketingCheckbox && !checkboxes.values.opt_in
|
|
167
177
|
? "False"
|
|
168
178
|
: "True";
|
|
179
|
+
|
|
169
180
|
const formData: SignupForm = {
|
|
170
181
|
user: userData as UserData,
|
|
182
|
+
eula: checkboxes.values.eula,
|
|
171
183
|
default_driver: DEFAULT_DRIVER,
|
|
172
184
|
info_email: InfoEmail
|
|
173
185
|
};
|
|
@@ -175,72 +187,24 @@ export default class DeSignupForm extends LightningElement {
|
|
|
175
187
|
return formData;
|
|
176
188
|
}
|
|
177
189
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
handleMarketingCheckbox(marketingCheckbox: any) {
|
|
188
|
-
this.marketingCheckbox = marketingCheckbox.target.checked;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
setLegalAndMarketingData(countryOptions: CountryOptions) {
|
|
192
|
-
// Set the checkbox text
|
|
193
|
-
this.setCheckboxTextSet(
|
|
194
|
-
countryOptions.marketingText,
|
|
195
|
-
countryOptions.learnMore
|
|
196
|
-
? `${countryOptions.legalText} </br> ${countryOptions.learnMore}`
|
|
197
|
-
: countryOptions.legalText
|
|
198
|
-
);
|
|
199
|
-
|
|
200
|
-
// Toggle visibility of legal/marketing data
|
|
201
|
-
this.toggleLegalAndMarketingVisibility(
|
|
202
|
-
countryOptions.showMarketingText,
|
|
203
|
-
countryOptions.showLegalCheckbox
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
setCheckboxTextSet(marketingText: string, privacyText: string) {
|
|
208
|
-
this.marketingText = marketingText;
|
|
209
|
-
this.privacyText = privacyText;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
toggleLegalAndMarketingVisibility(
|
|
213
|
-
showMarketingCheckbox: boolean,
|
|
214
|
-
showLegalCheckbox: boolean
|
|
215
|
-
) {
|
|
216
|
-
this.showMarketingCheckbox = showMarketingCheckbox;
|
|
217
|
-
this.showLegalCheckbox = showLegalCheckbox;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
setInnerHtml(element: HTMLElement, value: string) {
|
|
221
|
-
// disable lwc warning because text received from json has HTML
|
|
222
|
-
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
223
|
-
element.innerHTML = value;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
async getCountryList() {
|
|
227
|
-
const errorMsg = "Error while getting county list";
|
|
228
|
-
|
|
229
|
-
try {
|
|
230
|
-
const res = await fetch(
|
|
231
|
-
`${this.drmDomain}/utilities/services/apexrest/countries`
|
|
232
|
-
);
|
|
190
|
+
private getCheckboxesResult(): {
|
|
191
|
+
valid: boolean;
|
|
192
|
+
values: { eula: string; opt_in: "true" | "false" };
|
|
193
|
+
} {
|
|
194
|
+
let valid = true;
|
|
195
|
+
const values: { eula: string; opt_in: "true" | "false" } = {
|
|
196
|
+
eula: "",
|
|
197
|
+
opt_in: "false"
|
|
198
|
+
};
|
|
233
199
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
200
|
+
Array.from(
|
|
201
|
+
this.template.querySelectorAll<HTMLInputElement>("dx-checkbox")
|
|
202
|
+
).forEach((checkbox) => {
|
|
203
|
+
valid = valid && checkbox.reportValidity();
|
|
204
|
+
values[checkbox.name] = checkbox.checked;
|
|
205
|
+
});
|
|
237
206
|
|
|
238
|
-
|
|
239
|
-
// eslint-disable-next-line @lwc/lwc/no-api-reassignments
|
|
240
|
-
this._countries = JSON.stringify(data);
|
|
241
|
-
} catch (error) {
|
|
242
|
-
console.error(error);
|
|
243
|
-
}
|
|
207
|
+
return { valid, values };
|
|
244
208
|
}
|
|
245
209
|
|
|
246
210
|
private updateInnerHtml(
|
|
@@ -548,7 +548,6 @@ export default abstract class DocsGrid extends LightningElement {
|
|
|
548
548
|
this.selectedProductFilters?.forEach((filter) => {
|
|
549
549
|
track(document, "custEv_filterAbandoned", {
|
|
550
550
|
click_text: filter,
|
|
551
|
-
click_url: filter,
|
|
552
551
|
element_title: "docs grid",
|
|
553
552
|
element_type: "filter abandoned",
|
|
554
553
|
content_category: "filter"
|