@moontra/moonui-pro 2.32.4 → 2.32.6
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/dist/index.global.js +90 -90
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +69 -20
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2066,6 +2066,7 @@ var isInitialized = false;
|
|
|
2066
2066
|
var subscribers = [];
|
|
2067
2067
|
var CACHE_KEY = "moonui_license_cache";
|
|
2068
2068
|
var CACHE_DURATION = 1 * 60 * 1e3 ;
|
|
2069
|
+
var OFFLINE_GRACE_PERIOD = 5 * 60 * 1e3 ;
|
|
2069
2070
|
function notifySubscribers() {
|
|
2070
2071
|
subscribers.forEach((callback) => callback());
|
|
2071
2072
|
}
|
|
@@ -2096,26 +2097,74 @@ async function validateLicense() {
|
|
|
2096
2097
|
});
|
|
2097
2098
|
return;
|
|
2098
2099
|
}
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2100
|
+
try {
|
|
2101
|
+
const response = await fetch("https://moonui.dev/api/auth/validate", {
|
|
2102
|
+
headers: {
|
|
2103
|
+
"Authorization": `Bearer ${token}`
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
if (response.ok) {
|
|
2107
|
+
const data = await response.json();
|
|
2108
|
+
const cacheData = {
|
|
2109
|
+
valid: data.valid,
|
|
2110
|
+
hasLifetimeAccess: data.user?.hasLifetimeAccess || false,
|
|
2111
|
+
timestamp: Date.now(),
|
|
2112
|
+
cacheUntil: data.cacheUntil ? new Date(data.cacheUntil).getTime() : void 0
|
|
2113
|
+
};
|
|
2114
|
+
if (typeof window !== "undefined") {
|
|
2115
|
+
localStorage.setItem(CACHE_KEY, JSON.stringify(cacheData));
|
|
2116
|
+
}
|
|
2117
|
+
const hasProAccess = data.valid && (data.user?.hasLifetimeAccess || data.user?.features?.includes("pro_components"));
|
|
2118
|
+
updateGlobalState({
|
|
2119
|
+
hasProAccess,
|
|
2120
|
+
isAuthenticated: data.valid,
|
|
2121
|
+
subscriptionPlan: hasProAccess ? "lifetime" : "free",
|
|
2122
|
+
subscription: {
|
|
2123
|
+
status: hasProAccess ? "active" : "inactive",
|
|
2124
|
+
plan: hasProAccess ? "lifetime" : "free"
|
|
2125
|
+
},
|
|
2126
|
+
isLoading: false
|
|
2127
|
+
});
|
|
2128
|
+
} else {
|
|
2129
|
+
if (typeof window !== "undefined") {
|
|
2130
|
+
localStorage.removeItem(CACHE_KEY);
|
|
2131
|
+
}
|
|
2132
|
+
updateGlobalState({
|
|
2133
|
+
hasProAccess: false,
|
|
2134
|
+
isAuthenticated: false,
|
|
2135
|
+
isLoading: false
|
|
2136
|
+
});
|
|
2137
|
+
}
|
|
2138
|
+
} catch (error) {
|
|
2139
|
+
console.error("[MoonUI Pro] Network error during license validation:", error);
|
|
2140
|
+
if (typeof window !== "undefined") {
|
|
2141
|
+
const cached = localStorage.getItem(CACHE_KEY);
|
|
2142
|
+
if (cached) {
|
|
2143
|
+
const cacheData = JSON.parse(cached);
|
|
2144
|
+
const now = Date.now();
|
|
2145
|
+
if (now - cacheData.timestamp < OFFLINE_GRACE_PERIOD) {
|
|
2146
|
+
console.log("[MoonUI Pro] Development: Using cached access during network error");
|
|
2147
|
+
updateGlobalState({
|
|
2148
|
+
hasProAccess: cacheData.valid && cacheData.hasLifetimeAccess,
|
|
2149
|
+
isAuthenticated: cacheData.valid,
|
|
2150
|
+
subscriptionPlan: cacheData.valid && cacheData.hasLifetimeAccess ? "lifetime" : "free",
|
|
2151
|
+
subscription: {
|
|
2152
|
+
status: cacheData.valid && cacheData.hasLifetimeAccess ? "active" : "inactive",
|
|
2153
|
+
plan: cacheData.valid && cacheData.hasLifetimeAccess ? "lifetime" : "free"
|
|
2154
|
+
},
|
|
2155
|
+
isLoading: false
|
|
2156
|
+
});
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
}
|
|
2160
|
+
}
|
|
2161
|
+
console.log("[MoonUI Pro] Denying access due to network error (production security)");
|
|
2162
|
+
updateGlobalState({
|
|
2163
|
+
hasProAccess: false,
|
|
2164
|
+
isAuthenticated: false,
|
|
2165
|
+
isLoading: false
|
|
2166
|
+
});
|
|
2167
|
+
}
|
|
2119
2168
|
}
|
|
2120
2169
|
async function initializeAuth() {
|
|
2121
2170
|
if (isInitialized)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.6",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|