@salesforcedevs/dw-components 1.3.215-canary.0 → 1.3.219-canary.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.215-canary.0",
3
+ "version": "1.3.219-canary.0",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -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
@@ -113,7 +114,21 @@ export default class DeSignupForm extends LightningElement {
113
114
  return;
114
115
  }
115
116
 
117
+ // Due to Heroku's non-configurable 30 second request timeout, the POST request that
118
+ // submits the form can "fail" even though org creation is actually succeeding (but
119
+ // taking longer than 30 seconds). The back-end only gives us a "generic" error in that
120
+ // case, so we use a "good enough" heuristic here and direct the user to an "account-verification"
121
+ // page that doesn't ultimately say things worked, but tells them to watch their email.
122
+ // This should be a temporary bandaid, not a full solution.
123
+ let didSubmitTimeout = false;
124
+ let formSubmissionTimeoutId: number | undefined = window.setTimeout(
125
+ () => {
126
+ didSubmitTimeout = true;
127
+ },
128
+ SIGN_UP_FORM_TIMEOUT_MS
129
+ );
116
130
  this.disableSubmit = true;
131
+
117
132
  submitForm(formData)
118
133
  .then(() => {
119
134
  trackGtm(event.target!, "custEv_signUp", {
@@ -136,14 +151,27 @@ export default class DeSignupForm extends LightningElement {
136
151
  window.location.href = "/signup/success";
137
152
  })
138
153
  .catch((error) => {
139
- if (error.message === ErrorCode.DUPLICATE) {
140
- this.knownDuplicateUsers.push(formData.user.username);
141
- return;
154
+ if (error.message === ErrorCode.GENERIC && didSubmitTimeout) {
155
+ // If the timeout time has passed at the point of error, and the error code is simply "GENERIC",
156
+ // we do not know whether the org will ultimately be created (and we have no current way of confirming),
157
+ // so we navigate the user to an interim page that tells them to watch their email.
158
+ window.location.href = "/signup/account-verification";
159
+ } else {
160
+ this.disableSubmit = false;
161
+ if (error.message === ErrorCode.DUPLICATE) {
162
+ this.knownDuplicateUsers.push(formData.user.username);
163
+ } else {
164
+ console.log(
165
+ "Oops, something went wrong",
166
+ error.message
167
+ );
168
+ }
142
169
  }
143
-
144
- console.log("Oops, something went wrong", error.message);
145
170
  })
146
- .finally(() => (this.disableSubmit = false));
171
+ .finally(() => {
172
+ clearTimeout(formSubmissionTimeoutId);
173
+ formSubmissionTimeoutId = undefined;
174
+ });
147
175
  }
148
176
 
149
177
  handleKeyDown(e: KeyboardEvent): void {