web-manager 4.0.30 → 4.0.31
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 +8 -0
- package/dist/index.js +44 -7
- package/dist/modules/utilities.js +88 -38
- package/firebase-debug.log +56 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -15,6 +15,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
15
15
|
- `Security` in case of vulnerabilities.
|
|
16
16
|
|
|
17
17
|
---
|
|
18
|
+
## [4.0.31] - 2025-12-03
|
|
19
|
+
### Added
|
|
20
|
+
- Added HTML data attributes (`data-platform`, `data-runtime`, `data-device`) on initialization for CSS targeting.
|
|
21
|
+
- Added `getPlatform()`, `getRuntime()`, `isMobile()`, and `getDeviceType()` as standalone exported utility functions.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Refactored `getContext()` to use the new standalone functions and include `deviceType` and `runtime` in client info.
|
|
25
|
+
|
|
18
26
|
## [4.0.29] - 2025-12-02
|
|
19
27
|
### Fixed
|
|
20
28
|
- Fixed notification subscription storing to incorrect Firestore path (`users/{uid}/notifications/{token}` → `notifications/{token}`).
|
package/dist/index.js
CHANGED
|
@@ -75,6 +75,9 @@ class Manager {
|
|
|
75
75
|
// Store configuration as-is
|
|
76
76
|
this.config = this._processConfiguration(configuration);
|
|
77
77
|
|
|
78
|
+
// Set platform and runtime on HTML element
|
|
79
|
+
this._setHtmlDataAttributes();
|
|
80
|
+
|
|
78
81
|
// Initialize Firebase if enabled
|
|
79
82
|
if (this.config.firebase?.app?.enabled) {
|
|
80
83
|
await this._initializeFirebase();
|
|
@@ -306,6 +309,24 @@ class Manager {
|
|
|
306
309
|
}
|
|
307
310
|
}
|
|
308
311
|
|
|
312
|
+
_setHtmlDataAttributes() {
|
|
313
|
+
// Skip if not in browser environment
|
|
314
|
+
if (typeof document === 'undefined') {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
const $html = document.documentElement;
|
|
319
|
+
|
|
320
|
+
// Set platform (OS) - windows, mac, linux, ios, android, chromeos, unknown
|
|
321
|
+
$html.dataset.platform = utilities.getPlatform();
|
|
322
|
+
|
|
323
|
+
// Set runtime - web, extension, electron, node
|
|
324
|
+
$html.dataset.runtime = utilities.getRuntime();
|
|
325
|
+
|
|
326
|
+
// Set device type - mobile, tablet, desktop
|
|
327
|
+
$html.dataset.device = utilities.getDeviceType();
|
|
328
|
+
}
|
|
329
|
+
|
|
309
330
|
async _initializeFirebase() {
|
|
310
331
|
const firebaseConfig = this.config.firebase.app.config;
|
|
311
332
|
|
|
@@ -427,14 +448,17 @@ class Manager {
|
|
|
427
448
|
}
|
|
428
449
|
|
|
429
450
|
_startVersionCheck() {
|
|
430
|
-
//
|
|
431
|
-
window
|
|
432
|
-
|
|
433
|
-
|
|
451
|
+
// Quit if window is not available
|
|
452
|
+
if (typeof window !== 'undefined') {
|
|
453
|
+
// Re-focus events
|
|
454
|
+
window.addEventListener('focus', () => {
|
|
455
|
+
this._checkVersion();
|
|
456
|
+
});
|
|
434
457
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
458
|
+
window.addEventListener('online', () => {
|
|
459
|
+
this._checkVersion();
|
|
460
|
+
});
|
|
461
|
+
}
|
|
438
462
|
|
|
439
463
|
// Set up interval
|
|
440
464
|
this._versionCheckInterval = setInterval(() => {
|
|
@@ -443,6 +467,12 @@ class Manager {
|
|
|
443
467
|
}
|
|
444
468
|
|
|
445
469
|
_setupNotificationAutoRequest() {
|
|
470
|
+
// Quit if document is not available
|
|
471
|
+
if (typeof document === 'undefined') {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// Set up click listener to request notification permissions
|
|
446
476
|
const handleClick = () => {
|
|
447
477
|
// Remove listener after first click
|
|
448
478
|
document.removeEventListener('click', handleClick);
|
|
@@ -539,8 +569,15 @@ class Manager {
|
|
|
539
569
|
return; // No update needed
|
|
540
570
|
}
|
|
541
571
|
|
|
572
|
+
// New version detected
|
|
542
573
|
console.log('[Version] New version detected, reloading page...');
|
|
543
574
|
|
|
575
|
+
// If running in a non-browser environment, warn and return
|
|
576
|
+
if (typeof window === 'undefined') {
|
|
577
|
+
console.warn('[Version] Cannot reload in non-browser environment');
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
|
|
544
581
|
// Force page reload
|
|
545
582
|
window.onbeforeunload = function () {
|
|
546
583
|
return undefined;
|
|
@@ -94,55 +94,105 @@ export function showNotification(message, options = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// Get
|
|
98
|
-
export function
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
97
|
+
// Get platform (OS)
|
|
98
|
+
export function getPlatform() {
|
|
99
|
+
const ua = navigator.userAgent.toLowerCase();
|
|
100
|
+
const platform = (navigator.userAgentData?.platform || navigator.platform || '').toLowerCase();
|
|
101
|
+
|
|
102
|
+
// Check userAgent for mobile platforms (more reliable than platform string)
|
|
103
|
+
if (/iphone|ipad|ipod/.test(ua)) {
|
|
104
|
+
return 'ios';
|
|
105
|
+
}
|
|
106
|
+
if (/android/.test(ua)) {
|
|
107
|
+
return 'android';
|
|
108
|
+
}
|
|
110
109
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
// Check platform string for desktop OS
|
|
111
|
+
if (/win/.test(platform)) {
|
|
112
|
+
return 'windows';
|
|
113
|
+
}
|
|
114
|
+
if (/mac/.test(platform)) {
|
|
115
|
+
return 'mac';
|
|
116
|
+
}
|
|
117
|
+
if (/cros/.test(ua)) {
|
|
118
|
+
return 'chromeos';
|
|
119
|
+
}
|
|
120
|
+
if (/linux/.test(platform)) {
|
|
121
|
+
return 'linux';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return 'unknown';
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Get runtime environment
|
|
128
|
+
export function getRuntime() {
|
|
129
|
+
// Browser extension
|
|
130
|
+
if (typeof chrome !== 'undefined' && chrome.runtime?.id) {
|
|
131
|
+
return 'extension';
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Electron
|
|
135
|
+
if (typeof process !== 'undefined' && process.versions?.electron) {
|
|
136
|
+
return 'electron';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Node.js (no window)
|
|
140
|
+
if (typeof window === 'undefined') {
|
|
141
|
+
return 'node';
|
|
117
142
|
}
|
|
118
143
|
|
|
119
|
-
//
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return 'macos';
|
|
131
|
-
} else if (/linux/.test(platform)) {
|
|
132
|
-
return 'linux';
|
|
133
|
-
} else if (/cros/.test(platform)) {
|
|
134
|
-
return 'chromeos';
|
|
135
|
-
} else {
|
|
136
|
-
return 'unknown';
|
|
144
|
+
// Default: web browser
|
|
145
|
+
return 'web';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Check if mobile device
|
|
149
|
+
export function isMobile() {
|
|
150
|
+
try {
|
|
151
|
+
// Try modern API first
|
|
152
|
+
const m = navigator.userAgentData?.mobile;
|
|
153
|
+
if (typeof m !== 'undefined') {
|
|
154
|
+
return m === true;
|
|
137
155
|
}
|
|
156
|
+
} catch (e) {
|
|
157
|
+
// Silent fail
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Fallback to media query
|
|
161
|
+
try {
|
|
162
|
+
return window.matchMedia('(max-width: 767px)').matches;
|
|
163
|
+
} catch (e) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Get device type based on screen width
|
|
169
|
+
export function getDeviceType() {
|
|
170
|
+
const width = window.innerWidth;
|
|
171
|
+
|
|
172
|
+
// Mobile: < 768px (Bootstrap's md breakpoint)
|
|
173
|
+
if (width < 768) {
|
|
174
|
+
return 'mobile';
|
|
138
175
|
}
|
|
139
176
|
|
|
177
|
+
// Tablet: 768px - 1199px (between md and xl)
|
|
178
|
+
if (width < 1200) {
|
|
179
|
+
return 'tablet';
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Desktop: >= 1200px
|
|
183
|
+
return 'desktop';
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Get context information
|
|
187
|
+
export function getContext() {
|
|
140
188
|
// Return context information
|
|
141
189
|
return {
|
|
142
190
|
client: {
|
|
143
191
|
language: navigator.language,
|
|
144
192
|
mobile: isMobile(),
|
|
193
|
+
deviceType: getDeviceType(),
|
|
145
194
|
platform: getPlatform(),
|
|
195
|
+
runtime: getRuntime(),
|
|
146
196
|
userAgent: navigator.userAgent,
|
|
147
197
|
url: window.location.href,
|
|
148
198
|
},
|
|
@@ -160,6 +210,6 @@ export function getContext() {
|
|
|
160
210
|
// viewport: {
|
|
161
211
|
// width: window.innerWidth,
|
|
162
212
|
// height: window.innerHeight,
|
|
163
|
-
// }
|
|
213
|
+
// },
|
|
164
214
|
};
|
|
165
215
|
}
|
package/firebase-debug.log
CHANGED
|
@@ -322,3 +322,59 @@
|
|
|
322
322
|
[debug] [2025-12-02T21:13:04.584Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
323
323
|
[debug] [2025-12-02T21:13:04.585Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
324
324
|
[debug] [2025-12-02T21:13:04.585Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
325
|
+
[debug] [2025-12-04T02:16:36.479Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
326
|
+
[debug] [2025-12-04T02:16:36.482Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
327
|
+
[debug] [2025-12-04T02:16:36.482Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
328
|
+
[debug] [2025-12-04T02:16:36.482Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
329
|
+
[debug] [2025-12-04T02:16:36.546Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
330
|
+
[debug] [2025-12-04T02:16:36.547Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
331
|
+
[debug] [2025-12-04T02:16:36.547Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
332
|
+
[debug] [2025-12-04T02:16:36.549Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
333
|
+
[debug] [2025-12-04T02:16:36.550Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
334
|
+
[debug] [2025-12-04T02:16:36.550Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
335
|
+
[debug] [2025-12-04T02:16:36.583Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
336
|
+
[debug] [2025-12-04T02:16:36.583Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
337
|
+
[debug] [2025-12-04T02:16:36.610Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
338
|
+
[debug] [2025-12-04T02:16:36.610Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
339
|
+
[debug] [2025-12-04T02:16:36.611Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
340
|
+
[debug] [2025-12-04T02:16:36.612Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
341
|
+
[debug] [2025-12-04T02:16:36.615Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
342
|
+
[debug] [2025-12-04T02:16:36.616Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
343
|
+
[debug] [2025-12-04T02:16:36.616Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
344
|
+
[debug] [2025-12-04T02:16:36.616Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
345
|
+
[debug] [2025-12-04T02:16:36.620Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
346
|
+
[debug] [2025-12-04T02:16:36.620Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
347
|
+
[debug] [2025-12-04T02:16:36.621Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
348
|
+
[debug] [2025-12-04T02:16:36.621Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
349
|
+
[debug] [2025-12-04T02:16:36.624Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
350
|
+
[debug] [2025-12-04T02:16:36.624Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
351
|
+
[debug] [2025-12-04T02:16:36.624Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
352
|
+
[debug] [2025-12-04T02:16:36.625Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
353
|
+
[debug] [2025-12-04T02:16:38.036Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
354
|
+
[debug] [2025-12-04T02:16:38.038Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
355
|
+
[debug] [2025-12-04T02:16:38.038Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
356
|
+
[debug] [2025-12-04T02:16:38.038Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
357
|
+
[debug] [2025-12-04T02:16:38.049Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
358
|
+
[debug] [2025-12-04T02:16:38.049Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
359
|
+
[debug] [2025-12-04T02:16:38.070Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
360
|
+
[debug] [2025-12-04T02:16:38.070Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
361
|
+
[debug] [2025-12-04T02:16:38.071Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
362
|
+
[debug] [2025-12-04T02:16:38.071Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
363
|
+
[debug] [2025-12-04T02:16:38.075Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
364
|
+
[debug] [2025-12-04T02:16:38.076Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
365
|
+
[debug] [2025-12-04T02:16:38.076Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
366
|
+
[debug] [2025-12-04T02:16:38.076Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
367
|
+
[debug] [2025-12-04T02:16:38.272Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
368
|
+
[debug] [2025-12-04T02:16:38.275Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
369
|
+
[debug] [2025-12-04T02:16:38.275Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
370
|
+
[debug] [2025-12-04T02:16:38.275Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
371
|
+
[debug] [2025-12-04T02:16:38.284Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
372
|
+
[debug] [2025-12-04T02:16:38.284Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
373
|
+
[debug] [2025-12-04T02:16:38.302Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
374
|
+
[debug] [2025-12-04T02:16:38.302Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
375
|
+
[debug] [2025-12-04T02:16:38.303Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
376
|
+
[debug] [2025-12-04T02:16:38.303Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
377
|
+
[debug] [2025-12-04T02:16:38.304Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
378
|
+
[debug] [2025-12-04T02:16:38.304Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
|
379
|
+
[debug] [2025-12-04T02:16:38.306Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
|
|
380
|
+
[debug] [2025-12-04T02:16:38.306Z] > authorizing via signed-in user (ian.wiedenman@gmail.com)
|
package/package.json
CHANGED