@salesforcedevs/dw-components 1.3.26 → 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.26",
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": "31be8a973c75cec3678c6ec7308fb6099b29d055"
25
+ "gitHead": "50fad887e4e8cabd07608a64e55d41d69ece640a"
26
26
  }
@@ -25,7 +25,8 @@ span {
25
25
  }
26
26
 
27
27
  dx-checkbox,
28
- :not(dx-checkbox) > span {
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="jane@company.sandbox"
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={showMarketingField}
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={showLegalCheckbox}
90
+ if:true={showPrivacyCheckbox}
88
91
  required
89
- name="eula"
90
- value="accepted"
92
+ name="privacy"
93
+ value="privacy_accepted"
91
94
  >
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>
95
+ <span lwc:dom="manual" class="privacy-terms"></span>
98
96
  </dx-checkbox>
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>
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
- 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;
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
- get checkboxTextMap() {
67
- return this._checkboxTextMap;
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 showMarketingField(): boolean {
94
- return this.country && this.country.showMarketingField;
77
+ get showMarketingCheckbox(): boolean {
78
+ return this.country && this.country.showMarketingCheckbox;
95
79
  }
96
80
 
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
- );
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.showMarketingField
99
+ this.showMarketingCheckbox
139
100
  ) ||
140
101
  this.updateInnerHtml(
141
- "span.learn-more",
142
- this.learnMore,
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.showMarketingField
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.showMarketingField && checkboxes.values.opt_in === ""
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: this.showLegalCheckbox ? checkboxes.values.eula : ACCEPTED,
193
+ eula: checkboxes.values.eula,
233
194
  default_driver: DEFAULT_DRIVER,
234
195
  InfoEmail__c
235
196
  };