web-manager 4.1.3 → 4.1.4
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/CLAUDE.md +1 -1
- package/README.md +6 -6
- package/dist/index.js +2 -2
- package/dist/modules/utilities.js +3 -3
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -181,7 +181,7 @@ document.body.addEventListener('click', (e) => {
|
|
|
181
181
|
- **loadScript Options**: src, async, defer, crossorigin, integrity, timeout, retries
|
|
182
182
|
|
|
183
183
|
### Utilities (`utilities.js`)
|
|
184
|
-
- **Exports**: `clipboardCopy()`, `escapeHTML()`, `showNotification()`, `getPlatform()`, `getBrowser()`, `getRuntime()`, `isMobile()`, `
|
|
184
|
+
- **Exports**: `clipboardCopy()`, `escapeHTML()`, `showNotification()`, `getPlatform()`, `getBrowser()`, `getRuntime()`, `isMobile()`, `getDevice()`, `getContext()`
|
|
185
185
|
|
|
186
186
|
## Build System
|
|
187
187
|
|
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ Web Manager is designed to work in multiple environments:
|
|
|
108
108
|
- **Firebase v12 Integration**: Modern Firebase Auth, Firestore, and Cloud Messaging
|
|
109
109
|
- **Data Binding System**: Reactive DOM updates with `data-wm-bind` attributes
|
|
110
110
|
- **Storage API**: Enhanced localStorage/sessionStorage with path-based access and JSON serialization
|
|
111
|
-
- **Utilities**: `clipboardCopy()`, `escapeHTML()`, `getContext()`, `showNotification()`, `getPlatform()`, `getBrowser()`, `getRuntime()`, `isMobile()`, `
|
|
111
|
+
- **Utilities**: `clipboardCopy()`, `escapeHTML()`, `getContext()`, `showNotification()`, `getPlatform()`, `getBrowser()`, `getRuntime()`, `isMobile()`, `getDevice()`
|
|
112
112
|
- **DOM Utilities**: Dynamic script loading with retry/timeout support
|
|
113
113
|
- **Service Worker Management**: Registration, messaging, and state tracking
|
|
114
114
|
- **Push Notifications**: Firebase Cloud Messaging with auto-subscription
|
|
@@ -567,7 +567,7 @@ await notifications.syncSubscription();
|
|
|
567
567
|
|
|
568
568
|
**Features**:
|
|
569
569
|
- Stores subscription in localStorage and Firestore
|
|
570
|
-
- Tracks device context (platform, runtime,
|
|
570
|
+
- Tracks device context (platform, runtime, device)
|
|
571
571
|
- Auto-requests after configurable delay post-click
|
|
572
572
|
- Syncs with user authentication state
|
|
573
573
|
|
|
@@ -692,7 +692,7 @@ import {
|
|
|
692
692
|
getBrowser,
|
|
693
693
|
getRuntime,
|
|
694
694
|
isMobile,
|
|
695
|
-
|
|
695
|
+
getDevice,
|
|
696
696
|
getContext
|
|
697
697
|
} from 'web-manager/modules/utilities';
|
|
698
698
|
// Or: const utils = Manager.utilities();
|
|
@@ -720,13 +720,13 @@ getBrowser(); // 'chrome', 'firefox', 'safari', 'edge', 'opera', 'brave', null
|
|
|
720
720
|
getRuntime(); // 'web', 'browser-extension'
|
|
721
721
|
|
|
722
722
|
// Device detection
|
|
723
|
-
isMobile();
|
|
724
|
-
|
|
723
|
+
isMobile(); // true/false
|
|
724
|
+
getDevice(); // 'mobile' (<768px), 'tablet' (768-1199px), 'desktop' (>=1200px)
|
|
725
725
|
|
|
726
726
|
// Full context
|
|
727
727
|
getContext();
|
|
728
728
|
// {
|
|
729
|
-
// client: { language, mobile,
|
|
729
|
+
// client: { language, mobile, device, platform, browser, vendor, runtime, userAgent, url },
|
|
730
730
|
// geolocation: { ip, country, region, city, latitude, longitude }
|
|
731
731
|
// }
|
|
732
732
|
```
|
package/dist/index.js
CHANGED
|
@@ -367,8 +367,8 @@ class Manager {
|
|
|
367
367
|
// Set runtime - web, browser-extension, electron, node
|
|
368
368
|
$html.dataset.runtime = this._utilities.getRuntime();
|
|
369
369
|
|
|
370
|
-
// Set device
|
|
371
|
-
$html.dataset.device = this._utilities.
|
|
370
|
+
// Set device - mobile, tablet, desktop
|
|
371
|
+
$html.dataset.device = this._utilities.getDevice();
|
|
372
372
|
}
|
|
373
373
|
|
|
374
374
|
async _initializeFirebase() {
|
|
@@ -207,8 +207,8 @@ class Utilities {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
// Get device
|
|
211
|
-
|
|
210
|
+
// Get device based on screen width
|
|
211
|
+
getDevice() {
|
|
212
212
|
const width = window.innerWidth;
|
|
213
213
|
|
|
214
214
|
// Mobile: < 768px (Bootstrap's md breakpoint)
|
|
@@ -232,7 +232,7 @@ class Utilities {
|
|
|
232
232
|
client: {
|
|
233
233
|
language: navigator.language,
|
|
234
234
|
mobile: this.isMobile(),
|
|
235
|
-
|
|
235
|
+
device: this.getDevice(),
|
|
236
236
|
platform: this.getPlatform(),
|
|
237
237
|
browser: this.getBrowser(),
|
|
238
238
|
vendor: navigator.vendor,
|
package/package.json
CHANGED