web-manager 4.1.22 → 4.1.24
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 +10 -0
- package/dist/modules/auth.js +31 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
14
14
|
- `Fixed` for any bug fixes.
|
|
15
15
|
- `Security` in case of vulnerabilities.
|
|
16
16
|
|
|
17
|
+
---
|
|
18
|
+
## [4.1.24] - 2026-03-13
|
|
19
|
+
### Added
|
|
20
|
+
- Added `resolveSubscription()` method to Auth module that derives calculated subscription fields (plan, active, trialing, cancelling) from raw backend data.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
## [4.1.22] - 2026-03-11
|
|
24
|
+
### Changed
|
|
25
|
+
- Renamed `config.tracking` to `config.analytics` with simplified property names: `google-analytics` → `google`, `google-analytics-secret` → `googleSecret`, `meta-pixel` → `meta`, `tiktok-pixel` → `tiktok`.
|
|
26
|
+
|
|
17
27
|
---
|
|
18
28
|
## [4.1.19] - 2026-03-11
|
|
19
29
|
### Added
|
package/dist/modules/auth.js
CHANGED
|
@@ -218,6 +218,37 @@ class Auth {
|
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
// Resolves calculated subscription fields that require derivation logic
|
|
222
|
+
// Raw data (product.id, status, trial, cancellation) is on account.subscription directly
|
|
223
|
+
// Returns: { plan, active, trialing, cancelling }
|
|
224
|
+
// - plan: the plan ID the user effectively has access to RIGHT NOW ('basic' if cancelled/suspended)
|
|
225
|
+
// - active: user has active access (active, trialing, or cancelling)
|
|
226
|
+
// - trialing: user is in an active trial (backend status is 'active' but trial hasn't expired)
|
|
227
|
+
// - cancelling: cancellation is pending (backend status is 'active' but cancellation.pending is true)
|
|
228
|
+
resolveSubscription(account) {
|
|
229
|
+
const subscription = (account || this.manager.storage().get('auth', {})?.account)?.subscription || {};
|
|
230
|
+
const productId = subscription.product?.id || 'basic';
|
|
231
|
+
|
|
232
|
+
// Derive trial and cancelling states from raw backend data
|
|
233
|
+
let trialing = false;
|
|
234
|
+
let cancelling = false;
|
|
235
|
+
|
|
236
|
+
if (productId !== 'basic' && subscription.status === 'active') {
|
|
237
|
+
trialing = !!(subscription.trial?.claimed
|
|
238
|
+
&& subscription.trial?.expires?.timestampUNIX > Math.floor(Date.now() / 1000));
|
|
239
|
+
cancelling = !trialing && !!subscription.cancellation?.pending;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const active = (productId !== 'basic' && subscription.status === 'active');
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
plan: active ? productId : 'basic',
|
|
246
|
+
active,
|
|
247
|
+
trialing,
|
|
248
|
+
cancelling,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
221
252
|
// Get ID token for the current user
|
|
222
253
|
async getIdToken(forceRefresh = false) {
|
|
223
254
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-manager",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.24",
|
|
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",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@sentry/browser": "^10.43.0",
|
|
46
|
-
"chatsy": "^2.0.
|
|
46
|
+
"chatsy": "^2.0.5",
|
|
47
47
|
"firebase": "^12.10.0",
|
|
48
48
|
"itwcw-package-analytics": "^1.0.8",
|
|
49
49
|
"lodash": "^4.17.23"
|