web-manager 4.0.10 → 4.0.12

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 +23 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -99,6 +99,11 @@ class Manager {
99
99
  // Set up auth event listeners (uses event delegation, no need to wait for DOM)
100
100
  this._auth.setupEventListeners();
101
101
 
102
+ // Set up push notification auto-request if enabled
103
+ if (this.config.pushNotifications?.enabled && this.config.pushNotifications?.config?.autoRequest > 0) {
104
+ this._setupNotificationAutoRequest();
105
+ }
106
+
102
107
  // Old IE force polyfill
103
108
  // await this._loadPolyfillsIfNeeded();
104
109
 
@@ -377,7 +382,7 @@ class Manager {
377
382
  return 'http://localhost:5002';
378
383
  }
379
384
 
380
- const baseUrl = url || window.location.origin;
385
+ const baseUrl = url || this.config.firebase.app.config.authDomain || window.location.origin;
381
386
  const urlObj = new URL(baseUrl);
382
387
  const hostnameParts = urlObj.hostname.split('.');
383
388
 
@@ -421,6 +426,23 @@ class Manager {
421
426
  }, this.config.refreshNewVersion.config.interval);
422
427
  }
423
428
 
429
+ _setupNotificationAutoRequest() {
430
+ const handleClick = () => {
431
+ // Remove listener after first click
432
+ document.removeEventListener('click', handleClick);
433
+
434
+ // Set timeout to request notifications
435
+ setTimeout(() => {
436
+ console.log('Auto-requesting notification permissions...');
437
+ this._notifications.subscribe().catch(err => {
438
+ console.error('Notification subscription failed:', err.message);
439
+ });
440
+ }, this.config.pushNotifications.config.autoRequest);
441
+ };
442
+
443
+ // Wait for user click
444
+ document.addEventListener('click', handleClick);
445
+ }
424
446
 
425
447
  // async _loadPolyfillsIfNeeded() {
426
448
  // // Check if polyfills are needed by testing for ES6 features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
4
4
  "description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
5
5
  "main": "dist/index.js",
6
6
  "module": "src/index.js",