@salesforcedevs/dw-components 1.3.148-canary.29 → 1.3.148-canary.30

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.148-canary.29",
3
+ "version": "1.3.148-canary.30",
4
4
  "description": "Lightning web components for https://developer.salesforce.com",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -226,11 +226,10 @@ export default class J2sCardSequence extends LightningElement {
226
226
  // If the recaptcha element expires on its own while you are not on the 2nd (form) step, it messes with the
227
227
  // page's layout (basically breaks it). So, we need to reset it _before_ expiration if you leave that step.
228
228
  // We do it with a timeout so that the token is not immediately wiped if the user goes back and forth a bit.
229
- this._recaptchaResetTimeoutId = window.setTimeout(() => {
230
- this._recaptchaResetTimeoutId = null;
231
- this.recaptchaToken = "";
232
- (window as any).grecaptcha.reset();
233
- }, 1000 * 30 /* 30 seconds */);
229
+ this._recaptchaResetTimeoutId = window.setTimeout(
230
+ () => this.resetRecaptcha(),
231
+ 1000 * 30 /* 30 seconds */
232
+ );
234
233
  }
235
234
  }
236
235
 
@@ -274,6 +273,7 @@ export default class J2sCardSequence extends LightningElement {
274
273
  if (resOutput?.status === "success") {
275
274
  this.jumpToStepIndex(2, false);
276
275
  this.initialStepIndex = 0; // don't save final step in storage; rather, reset the starting step
276
+ this.resetRecaptcha();
277
277
  } else {
278
278
  throw new Error(
279
279
  `Form submission failed. (status: ${resOutput.status}, message: ${resOutput.errorMessage})`
@@ -318,6 +318,13 @@ export default class J2sCardSequence extends LightningElement {
318
318
  );
319
319
  }
320
320
 
321
+ private resetRecaptcha() {
322
+ clearTimeout(this._recaptchaResetTimeoutId as number);
323
+ this._recaptchaResetTimeoutId = null;
324
+ this.recaptchaToken = "";
325
+ (window as any).grecaptcha.reset();
326
+ }
327
+
321
328
  private jumpToStepIndex(stepIndex: number, andStoreIndex = true) {
322
329
  if (andStoreIndex) {
323
330
  this.initialStepIndex = stepIndex; // update sessionStorage value