@cloudsignal/pwa-sdk 1.2.0 → 1.2.2

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 (3) hide show
  1. package/CHANGELOG.md +68 -0
  2. package/LICENSE +21 -0
  3. package/package.json +3 -4
package/CHANGELOG.md CHANGED
@@ -5,6 +5,74 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.2.0] - 2025-01-17
9
+
10
+ ### Added
11
+
12
+ - **JWT Authentication** - User-linked registrations via JWT tokens from identity providers
13
+ - **Dual Auth Mode** - Support both HMAC (anonymous) and JWT (authenticated) authentication
14
+ - `userToken` config option for JWT tokens (Supabase, Firebase, Auth0, Clerk, custom OIDC)
15
+ - `onTokenExpired` callback for automatic token refresh on 401 errors
16
+ - `setUserToken()` method to upgrade from anonymous to authenticated registration
17
+ - `getAuthMode()` method to check current auth mode ('hmac' | 'jwt')
18
+ - `auth:tokenUpdated` event emitted when auth token is updated/upgraded
19
+ - Full TypeScript types for JWT auth utilities
20
+
21
+ ### Changed
22
+
23
+ - All API calls now support both HMAC signature and JWT Bearer token authentication
24
+ - Registration API extracts user_id and user_email from JWT claims when in JWT mode
25
+
26
+ ### Use Case
27
+
28
+ Enables smart notification routing - send in-app notifications when users are online (MQTT connected) and web push when offline by linking registrations to authenticated user identities.
29
+
30
+ ## [1.1.1] - 2025-01-17
31
+
32
+ ### Added
33
+
34
+ - **Vitest Test Framework** - Comprehensive unit test suite with jsdom environment
35
+ - **DeviceDetector Tests** - 16 tests covering device/browser/OS detection
36
+ - **WakeLockManager Tests** - 16 tests covering screen wake lock functionality
37
+ - **i18n Translation Tests** - 18 tests covering all 20 supported languages
38
+ - **Fingerprint Tests** - 7 tests covering unique device fingerprint generation
39
+ - `test:coverage` script for code coverage reporting
40
+ - Total: 57 unit tests passing
41
+
42
+ ## [1.1.0] - 2025-01-17
43
+
44
+ ### Added
45
+
46
+ - **Screen Wake Lock** - Prevent screen sleep during critical operations (WakeLockManager)
47
+ - **Offline Request Queue** - IndexedDB-backed queue with exponential backoff retry (OfflineQueueManager)
48
+ - **iOS Install Banner** - Beautiful modal guiding iOS Safari users to install (IOSInstallBanner)
49
+ - **20-Language i18n** - Auto-detects browser language for iOS banner
50
+ - Supported: en, es, fr, de, it, pt, nl, ru, zh, ja, ko, ar, he, hi, tr, pl, sv, da, no, fi
51
+ - **Network-Aware Heartbeat** - Auto-adjusts interval based on connection type (4G=30s, 3G=60s, 2G=120s)
52
+ - **Battery-Aware Heartbeat** - Pauses heartbeat when battery <15% and not charging
53
+ - **Notification Analytics** - Track displayed/clicked/dismissed events in service worker
54
+ - **Save Data Respect** - Reduces heartbeat frequency when user has Save Data enabled
55
+
56
+ ### New Config Options
57
+
58
+ - `wakeLock` - Screen wake lock configuration
59
+ - `offlineQueue` - Offline request queue settings
60
+ - `iosInstallBanner` - iOS install banner customization
61
+ - `notificationAnalytics` - Analytics tracking settings
62
+
63
+ ### New Events
64
+
65
+ - `wakeLock:acquired`, `wakeLock:released`, `wakeLock:error`
66
+ - `offlineQueue:queued`, `offlineQueue:processed`, `offlineQueue:flushed`
67
+ - `iosBanner:shown`, `iosBanner:dismissed`, `iosBanner:installClicked`
68
+ - `heartbeat:intervalChanged`, `heartbeat:pausedForBattery`, `heartbeat:resumedFromBattery`
69
+
70
+ ### Browser Support Notes
71
+
72
+ - Wake Lock: All modern browsers as of March 2025
73
+ - Battery API: Chromium-based browsers only
74
+ - Network Information API: Chromium-based browsers (graceful fallback)
75
+
8
76
  ## [1.0.0] - 2025-01-14
9
77
 
10
78
  ### Added
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 CloudSignal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudsignal/pwa-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "CloudSignal PWA SDK - Progressive Web App features with push notifications, JWT/HMAC authentication, installation management, device tracking, offline queue, wake lock, and notification analytics",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -55,11 +55,10 @@
55
55
  "license": "MIT",
56
56
  "repository": {
57
57
  "type": "git",
58
- "url": "https://github.com/cloudsignal/vernemq-service.git",
59
- "directory": "cloudsignal-pwa-sdk"
58
+ "url": "https://github.com/cloudsignal/pwa-sdk.git"
60
59
  },
61
60
  "bugs": {
62
- "url": "https://github.com/cloudsignal/vernemq-service/issues"
61
+ "url": "https://github.com/cloudsignal/pwa-sdk/issues"
63
62
  },
64
63
  "homepage": "https://cloudsignal.io",
65
64
  "publishConfig": {