@zaptcha/widget 1.0.2 → 1.0.3

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.
@@ -637,39 +637,27 @@ class ZeroCaptcha extends HTMLElement {
637
637
  // ── Worker messages ──────────────────────────────────────────────────────
638
638
 
639
639
  _onWorkerMsg(msg) {
640
- console.debug("[zaptcha] worker msg:", msg.type, msg.type === "fail" ? msg.reason : "");
641
640
  switch (msg.type) {
642
- case "ready":
643
- console.debug("[zaptcha] WASM ready ✓");
644
- break;
645
-
646
641
  case "progress":
647
- this._progress.done = (msg.index ?? 0) + 1;
648
- this._progress.total = msg.total ?? 1;
649
- this.dispatchEvent(new CustomEvent("zaptcha-progress", {
650
- bubbles: true, composed: true,
651
- detail: {
652
- index: msg.index, nonce: msg.nonce, total: msg.total,
653
- pct: Math.round(((msg.index ?? 0) + 1) / (msg.total ?? 1) * 100),
654
- },
655
- }));
642
+ console.debug("[zaptcha] progress:", {
643
+ index: msg.index,
644
+ nonce: msg.nonce,
645
+ total: msg.total,
646
+ });
656
647
  break;
657
-
648
+
658
649
  case "success":
659
- this._state = "done";
660
- this._applyState();
661
- this.dispatchEvent(new CustomEvent("zaptcha-success", {
662
- bubbles: true, composed: true,
663
- detail: { token: msg.token },
664
- }));
650
+ console.debug("[zaptcha] success");
665
651
  break;
666
-
652
+
667
653
  case "fail":
668
- this._onFail(msg.reason || "Unknown error");
654
+ console.debug("[zaptcha] fail:", msg.reason);
669
655
  break;
656
+
657
+ default:
658
+ console.debug("[zaptcha] unknown:", msg);
670
659
  }
671
660
  }
672
-
673
661
  // ── Events ───────────────────────────────────────────────────────────────
674
662
 
675
663
  _bindEvents() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaptcha/widget",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/zaptcha-widget.js",
6
6
  "types": "./src/zaptcha.d.ts",