@salesforcedevs/dw-components 1.3.218 → 1.3.225

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.218",
3
+ "version": "1.3.225",
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": "4da04a9390fd75ee83751992b259acb60a47fd98"
27
+ "gitHead": "e7e2b7ebb5f6b791661026834a9192022fe256ff"
28
28
  }
@@ -1,4 +1,11 @@
1
1
  :host {
2
+ --dx-c-button-custom-background: var(--dx-g-blue-vibrant-50);
3
+ --dx-c-button-custom-color: white;
4
+ --dx-c-button-custom-border: var(--dx-g-blue-vibrant-50);
5
+ --dx-c-button-custom-color-hover: white;
6
+ --dx-c-button-custom-background-hover: var(--dx-g-blue-vibrant-40);
7
+ --dx-c-button-custom-border-hover: var(--dx-g-blue-vibrant-40);
8
+
2
9
  display: block;
3
10
  }
4
11
 
@@ -55,11 +62,6 @@ form > .full-name-field {
55
62
  width: 100%;
56
63
  }
57
64
 
58
- .form-submit:hover {
59
- background-color: var(--dx-g-blue-vibrant-40);
60
- border-color: var(--dx-g-blue-vibrant-40);
61
- }
62
-
63
65
  @media screen and (min-width: 641px) {
64
66
  form > .full-name-field:first-of-type {
65
67
  margin-right: var(--dx-g-spacing-lg);
@@ -119,6 +119,7 @@
119
119
 
120
120
  <dx-button
121
121
  class="submit-button"
122
+ variant="custom"
122
123
  disabled={disableSubmit}
123
124
  size="large"
124
125
  type="submit"
@@ -16,6 +16,7 @@ const DEFAULT_DRIVER = "7013000000005wb";
16
16
  const DUPLICATE_USERNAME_MESSAGE =
17
17
  "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.";
18
18
  const SIGN_UP_LABEL = "Sign me Up";
19
+ const SIGN_UP_FORM_TIMEOUT_MS = 18.5 * 1000; // Something in trialforce/DRM's backend (still under investigation) is causing requests to timeout around 20 seconds; we use 18.5 here in case it's sometimes a little faster than that
19
20
 
20
21
  export default class DeSignupForm extends LightningElement {
21
22
  @api
@@ -98,6 +99,26 @@ export default class DeSignupForm extends LightningElement {
98
99
  return uuid;
99
100
  }
100
101
 
102
+ setSubmitButtonDisabled(isDisabled: boolean): void {
103
+ this.disableSubmit = isDisabled;
104
+
105
+ let backgroundAndBorderColor: string;
106
+ if (isDisabled) {
107
+ backgroundAndBorderColor = "var(--dx-g-gray-80)";
108
+ } else {
109
+ backgroundAndBorderColor = "var(--dx-g-blue-vibrant-50)";
110
+ }
111
+
112
+ this.template.host.style.setProperty(
113
+ "--dx-c-button-custom-background",
114
+ backgroundAndBorderColor
115
+ );
116
+ this.template.host.style.setProperty(
117
+ "--dx-c-button-custom-border",
118
+ backgroundAndBorderColor
119
+ );
120
+ }
121
+
101
122
  handleSubmit(event: Event): void {
102
123
  event.preventDefault();
103
124
 
@@ -113,7 +134,21 @@ export default class DeSignupForm extends LightningElement {
113
134
  return;
114
135
  }
115
136
 
116
- this.disableSubmit = true;
137
+ // Due to Heroku's non-configurable 30 second request timeout, the POST request that
138
+ // submits the form can "fail" even though org creation is actually succeeding (but
139
+ // taking longer than 30 seconds). The back-end only gives us a "generic" error in that
140
+ // case, so we use a "good enough" heuristic here and direct the user to an "account-verification"
141
+ // page that doesn't ultimately say things worked, but tells them to watch their email.
142
+ // This should be a temporary bandaid, not a full solution.
143
+ let didSubmitTimeout = false;
144
+ let formSubmissionTimeoutId: number | undefined = window.setTimeout(
145
+ () => {
146
+ didSubmitTimeout = true;
147
+ },
148
+ SIGN_UP_FORM_TIMEOUT_MS
149
+ );
150
+
151
+ this.setSubmitButtonDisabled(true);
117
152
  submitForm(formData)
118
153
  .then(() => {
119
154
  trackGtm(event.target!, "custEv_signUp", {
@@ -136,14 +171,27 @@ export default class DeSignupForm extends LightningElement {
136
171
  window.location.href = "/signup/success";
137
172
  })
138
173
  .catch((error) => {
139
- if (error.message === ErrorCode.DUPLICATE) {
140
- this.knownDuplicateUsers.push(formData.user.username);
141
- return;
174
+ if (error.message === ErrorCode.GENERIC && didSubmitTimeout) {
175
+ // If the timeout time has passed at the point of error, and the error code is simply "GENERIC",
176
+ // we do not know whether the org will ultimately be created (and we have no current way of confirming),
177
+ // so we navigate the user to an interim page that tells them to watch their email.
178
+ window.location.href = "/signup/account-verification";
179
+ } else {
180
+ this.setSubmitButtonDisabled(false);
181
+ if (error.message === ErrorCode.DUPLICATE) {
182
+ this.knownDuplicateUsers.push(formData.user.username);
183
+ } else {
184
+ console.warn(
185
+ "Oops, something went wrong",
186
+ error.message
187
+ );
188
+ }
142
189
  }
143
-
144
- console.log("Oops, something went wrong", error.message);
145
190
  })
146
- .finally(() => (this.disableSubmit = false));
191
+ .finally(() => {
192
+ clearTimeout(formSubmissionTimeoutId);
193
+ formSubmissionTimeoutId = undefined;
194
+ });
147
195
  }
148
196
 
149
197
  handleKeyDown(e: KeyboardEvent): void {