web-manager 4.1.3 → 4.1.5

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 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()`, `getDeviceType()`, `getContext()`
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()`, `getDeviceType()`
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, deviceType)
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
- getDeviceType,
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(); // true/false
724
- getDeviceType(); // 'mobile' (<768px), 'tablet' (768-1199px), 'desktop' (>=1200px)
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, deviceType, platform, browser, vendor, runtime, userAgent, url },
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 type - mobile, tablet, desktop
371
- $html.dataset.device = this._utilities.getDeviceType();
370
+ // Set device - mobile, tablet, desktop
371
+ $html.dataset.device = this._utilities.getDevice();
372
372
  }
373
373
 
374
374
  async _initializeFirebase() {
@@ -278,8 +278,8 @@ class Notifications {
278
278
 
279
279
  // Determine if we need to update
280
280
  const currentUid = user?.uid || null;
281
- const existingUid = existingData?.uid || null;
282
- const needsUpdate = existingUid !== currentUid;
281
+ const existingOwner = existingData?.owner || null;
282
+ const needsUpdate = existingOwner !== currentUid;
283
283
 
284
284
  // Common data for both create and update
285
285
  const baseData = {
@@ -290,7 +290,7 @@ class Notifications {
290
290
  timestamp,
291
291
  timestampUNIX
292
292
  },
293
- uid: currentUid
293
+ owner: currentUid
294
294
  };
295
295
 
296
296
  // Create or update the document as needed
@@ -300,6 +300,7 @@ class Notifications {
300
300
  ...baseData,
301
301
  token,
302
302
  tags: ['general'],
303
+ // TODO: add attribution data on create
303
304
  created: {
304
305
  timestamp,
305
306
  timestampUNIX
@@ -207,8 +207,8 @@ class Utilities {
207
207
  }
208
208
  }
209
209
 
210
- // Get device type based on screen width
211
- getDeviceType() {
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
- deviceType: this.getDeviceType(),
235
+ device: this.getDevice(),
236
236
  platform: this.getPlatform(),
237
237
  browser: this.getBrowser(),
238
238
  vendor: navigator.vendor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "web-manager",
3
- "version": "4.1.3",
3
+ "version": "4.1.5",
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",