altcha 3.0.5 → 3.0.6

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.
@@ -6076,7 +6076,7 @@
6076
6076
  }
6077
6077
  });
6078
6078
  onMount(() => {
6079
- log("mounted", "3.0.5");
6079
+ log("mounted", "3.0.6");
6080
6080
  if (instance) {
6081
6081
  globalThis.$altcha.instances.add(instance);
6082
6082
  }
@@ -6327,9 +6327,6 @@
6327
6327
  }
6328
6328
  }
6329
6329
  function onCloseClick() {
6330
- if (get(currentController)) {
6331
- get(currentController).abort();
6332
- }
6333
6330
  setDisplay(get(config).display);
6334
6331
  reset$1();
6335
6332
  }
@@ -6348,9 +6345,6 @@
6348
6345
  }
6349
6346
  }
6350
6347
  function onFormReset() {
6351
- if (get(currentController)) {
6352
- get(currentController).abort();
6353
- }
6354
6348
  setDisplay(get(config).display);
6355
6349
  reset$1();
6356
6350
  }
@@ -6369,9 +6363,11 @@
6369
6363
  });
6370
6364
  }
6371
6365
  }
6372
- function onWindowPageshow() {
6373
- setDisplay(get(config).display);
6374
- reset$1();
6366
+ function onWindowPageshow(ev) {
6367
+ if (ev.persisted) {
6368
+ setDisplay(get(config).display);
6369
+ reset$1();
6370
+ }
6375
6371
  }
6376
6372
  function onWindowResize() {
6377
6373
  updateUI();
@@ -6592,6 +6588,9 @@
6592
6588
  set(checked, false);
6593
6589
  set(error, err, true);
6594
6590
  set(payload, null);
6591
+ if (get(currentController)) {
6592
+ get(currentController).abort();
6593
+ }
6595
6594
  if (get(expirationTimeout)) {
6596
6595
  clearTimeout(get(expirationTimeout));
6597
6596
  set(expirationTimeout, null);
@@ -6630,8 +6629,8 @@
6630
6629
  if (hook !== void 0) {
6631
6630
  return hook;
6632
6631
  }
6633
- set(currentController, controller, true);
6634
6632
  reset$1(State.VERIFYING);
6633
+ set(currentController, controller, true);
6635
6634
  try {
6636
6635
  if (!isSecureContext) {
6637
6636
  throw new Error("Secure context (HTTPS) required.");
@@ -6642,6 +6641,10 @@
6642
6641
  if (get(config).test) {
6643
6642
  log("running test mode with null challenge");
6644
6643
  await delay(Math.max(0, minDuration - (performance.now() - start)));
6644
+ if (get(currentController)?.signal.aborted) {
6645
+ reset$1();
6646
+ return null;
6647
+ }
6645
6648
  set(payload, btoa(JSON.stringify({ challenge: null, solution: null, test: true })), true);
6646
6649
  log("verified");
6647
6650
  setState(State.VERIFIED);