@whanext/core 0.19.9 → 0.19.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.19.10
4
+
5
+ - Fixed restored sessions incorrectly waiting for a pairing challenge after the WhatsApp connection was already open.
6
+ - Pairing-code requests now stop immediately when an existing authenticated session reconnects.
7
+
3
8
  ## 0.19.9
4
9
 
5
10
  - Fixed live `message_addon` edits being discarded when Zapo reports the parent message timestamp instead of the mutation timestamp.
package/dist/index.js CHANGED
@@ -2837,7 +2837,7 @@ var ZapoProvider = class {
2837
2837
  );
2838
2838
  }
2839
2839
  const client = await this.#ensureClient();
2840
- if (client.getCredentials()?.meJid) {
2840
+ if (client.getCredentials()?.meJid || this.#connected) {
2841
2841
  return "";
2842
2842
  }
2843
2843
  if (!this.#connectPromise && !this.#connected) {
@@ -2851,6 +2851,9 @@ var ZapoProvider = class {
2851
2851
  "The WhatsApp pairing challenge was not received in time."
2852
2852
  );
2853
2853
  }
2854
+ if (!this.#pairingRequired || this.#connected || client.getCredentials()?.meJid) {
2855
+ return "";
2856
+ }
2854
2857
  return await client.auth.requestPairingCode(normalized);
2855
2858
  } catch (error) {
2856
2859
  if (error instanceof WhaNextError) throw error;
@@ -3410,6 +3413,8 @@ var ZapoProvider = class {
3410
3413
  if (event.status === "open") {
3411
3414
  this.#connectPromise = void 0;
3412
3415
  this.#connected = true;
3416
+ this.#resolvePairingReady?.();
3417
+ this.#resolvePairingReady = void 0;
3413
3418
  this.#connectedAtSeconds = Math.floor(Date.now() / 1e3);
3414
3419
  this.#reconnectAttempt = 0;
3415
3420
  this.#closedNotified = false;