@thefittingroom/shop-ui 5.0.39 → 5.0.41

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.
Files changed (2) hide show
  1. package/dist/index.js +31 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -33990,19 +33990,46 @@ function getFirestoreManager() {
33990
33990
  }
33991
33991
  return firestoreManager;
33992
33992
  }
33993
+ const CROSS_TAB_NULL_DEBOUNCE_MS = 500;
33993
33994
  class AuthManager {
33994
33995
  constructor(auth, brandId) {
33995
33996
  this.userProfile = null;
33996
33997
  this.authStateChangeListeners = /* @__PURE__ */ new Set();
33997
33998
  this.userProfileChangeListeners = /* @__PURE__ */ new Set();
33998
33999
  this.listenToUserProfileUnsub = null;
34000
+ this.pendingNullDispatchTimeout = null;
33999
34001
  this.auth = auth;
34000
34002
  this.brandId = brandId;
34001
34003
  this.addAuthStateChangeListener((authUser) => this.handleAuthStateChanged(authUser));
34002
34004
  onAuthStateChanged(this.auth, (authUser) => {
34003
- this.authStateChangeListeners.forEach((callback) => callback(authUser));
34005
+ this.dispatchAuthStateChange(authUser);
34004
34006
  });
34005
34007
  }
34008
+ // Debounced dispatcher. See CROSS_TAB_NULL_DEBOUNCE_MS comment for
34009
+ // why. Users are dispatched immediately; nulls wait, and are
34010
+ // suppressed if a user arrives (or if auth.currentUser has recovered
34011
+ // by the time the timer fires).
34012
+ dispatchAuthStateChange(authUser) {
34013
+ if (authUser) {
34014
+ if (this.pendingNullDispatchTimeout !== null) {
34015
+ clearTimeout(this.pendingNullDispatchTimeout);
34016
+ this.pendingNullDispatchTimeout = null;
34017
+ }
34018
+ this.authStateChangeListeners.forEach((callback) => callback(authUser));
34019
+ return;
34020
+ }
34021
+ if (this.pendingNullDispatchTimeout !== null) {
34022
+ return;
34023
+ }
34024
+ this.pendingNullDispatchTimeout = setTimeout(() => {
34025
+ this.pendingNullDispatchTimeout = null;
34026
+ if (this.auth.currentUser !== null) {
34027
+ logger$e.logDebug("Suppressed transient null: auth.currentUser recovered before debounce fired");
34028
+ return;
34029
+ }
34030
+ this.authStateChangeListeners.forEach((callback) => callback(null));
34031
+ }, CROSS_TAB_NULL_DEBOUNCE_MS);
34032
+ }
34006
34033
  addAuthStateChangeListener(callback) {
34007
34034
  this.authStateChangeListeners.add(callback);
34008
34035
  callback(this.auth.currentUser);
@@ -48137,9 +48164,9 @@ const SHARED_CONFIG = {
48137
48164
  appGooglePlayUrl: "https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace"
48138
48165
  },
48139
48166
  build: {
48140
- version: `${"5.0.39"}`,
48141
- commitHash: `${"44a2874"}`,
48142
- date: `${"2026-07-18T10:17:07.725Z"}`
48167
+ version: `${"5.0.41"}`,
48168
+ commitHash: `${"0f7fea7"}`,
48169
+ date: `${"2026-07-18T10:51:27.242Z"}`
48143
48170
  }
48144
48171
  };
48145
48172
  const CONFIGS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thefittingroom/shop-ui",
3
- "version": "5.0.39",
3
+ "version": "5.0.41",
4
4
  "description": "the fitting room UI library",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",