@salesforcedevs/dw-components 1.3.218 → 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.218",
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": {
@@ -23,6 +23,5 @@
23
23
  "@types/lodash.uniqby": "^4.7.7",
24
24
  "@types/setimmediate": "^1.0.2",
25
25
  "setimmediate": "^1.0.5"
26
- },
27
- "gitHead": "4da04a9390fd75ee83751992b259acb60a47fd98"
26
+ }
28
27
  }
@@ -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 {
package/LICENSE DELETED
@@ -1,12 +0,0 @@
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.