web-manager 4.0.16 → 4.0.18
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.js +5 -0
- package/dist/modules/auth.js +2 -1
- package/dist/modules/notifications.js +0 -25
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -311,6 +311,11 @@ class Manager {
|
|
|
311
311
|
const { getFirestore } = await import('firebase/firestore');
|
|
312
312
|
const { getMessaging } = await import('firebase/messaging');
|
|
313
313
|
|
|
314
|
+
// If we're in devmode, set the firebase config authDomain to the current host
|
|
315
|
+
// if (this.isDevelopment() && firebaseConfig) {
|
|
316
|
+
// firebaseConfig.authDomain = window.location.hostname;
|
|
317
|
+
// }
|
|
318
|
+
|
|
314
319
|
// Initialize Firebase
|
|
315
320
|
const app = initializeApp(firebaseConfig);
|
|
316
321
|
|
package/dist/modules/auth.js
CHANGED
|
@@ -119,9 +119,10 @@ class Auth {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
let hasCalledback = false;
|
|
122
|
+
let unsubscribe = null;
|
|
122
123
|
|
|
123
124
|
// Set up listener for auth state changes
|
|
124
|
-
|
|
125
|
+
unsubscribe = this.onAuthStateChanged((user) => {
|
|
125
126
|
// If once option is set, unsubscribe
|
|
126
127
|
// We have to do this here because unsubscribe is only available after this call
|
|
127
128
|
if (options.once && unsubscribe) {
|
|
@@ -157,31 +157,6 @@ class Notifications {
|
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
// Listen for token refresh
|
|
161
|
-
async onTokenRefresh(callback) {
|
|
162
|
-
try {
|
|
163
|
-
if (!this.isSupported()) {
|
|
164
|
-
return () => {};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const { onMessage } = await import('firebase/messaging');
|
|
168
|
-
const messaging = this.manager.firebaseMessaging;
|
|
169
|
-
|
|
170
|
-
if (!messaging) {
|
|
171
|
-
return () => {};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return onMessage(messaging, (payload) => {
|
|
175
|
-
if (payload.data?.refreshToken) {
|
|
176
|
-
callback(payload.data.token);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
} catch (error) {
|
|
180
|
-
console.error('Token refresh listener error:', error);
|
|
181
|
-
return () => {};
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
160
|
// Listen for foreground messages
|
|
186
161
|
async onMessage(callback) {
|
|
187
162
|
try {
|
package/package.json
CHANGED