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