@chatsystem/client 1.2.2 → 1.2.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.
package/dist/index.mjs CHANGED
@@ -22989,6 +22989,17 @@ class ix {
22989
22989
  clear() {
22990
22990
  this.generation += 1, this.token = null, this.expiresAt = null, this.pendingRequest = null, this.pendingRequestIsInteractive = !1;
22991
22991
  }
22992
+ /**
22993
+ * Invalidates cached identity after a host login, logout, or account change.
22994
+ *
22995
+ * An interactive lookup is allowed to settle because host authentication
22996
+ * SDKs commonly emit their change notification before the login promise
22997
+ * resolves. Silent callers can then join that same lookup instead of minting
22998
+ * a second widget token. Other pending lookups are invalidated normally.
22999
+ */
23000
+ handleIdentityChanged() {
23001
+ this.token = null, this.expiresAt = null, !(this.pendingRequest && this.pendingRequestIsInteractive) && (this.generation += 1, this.pendingRequest = null, this.pendingRequestIsInteractive = !1);
23002
+ }
22992
23003
  async getToken(t) {
22993
23004
  if (!this.provider) return null;
22994
23005
  const n = Math.floor(Date.now() / 1e3);
@@ -23110,7 +23121,7 @@ const yd = ({
23110
23121
  const le = o.current;
23111
23122
  if (!(!le || !a))
23112
23123
  return le.getToken({ interactive: !1 }).catch(() => le.clear()), a.subscribe?.(() => {
23113
- le.clear(), b((Ie) => Ie + 1), le.getToken({ interactive: !1 }).catch(() => le.clear());
23124
+ le.handleIdentityChanged(), b((Ie) => Ie + 1), le.getToken({ interactive: !1 }).catch(() => le.clear());
23114
23125
  });
23115
23126
  }, [a]);
23116
23127
  const {