@moontra/moonui-pro 2.37.7 → 2.37.9
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/cdn/index.global.js +96 -96
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.mjs +50 -51
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2185,65 +2185,64 @@ function MoonUIAuthProvider({ children }) {
|
|
|
2185
2185
|
authPromise = (async () => {
|
|
2186
2186
|
try {
|
|
2187
2187
|
lastFetchTime = now;
|
|
2188
|
-
|
|
2189
|
-
const
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
"
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2188
|
+
const isProduction = false;
|
|
2189
|
+
const isDevelopment = true;
|
|
2190
|
+
if (isDevelopment) {
|
|
2191
|
+
let response;
|
|
2192
|
+
const authServerUrl = typeof window !== "undefined" ? process.env.NEXT_PUBLIC_MOONUI_AUTH_SERVER || "http://localhost:7878" : "http://localhost:7878";
|
|
2193
|
+
try {
|
|
2194
|
+
console.log("[MoonUI Auth] Checking CLI auth server at:", authServerUrl);
|
|
2195
|
+
response = await fetch(`${authServerUrl}/validate`, {
|
|
2196
|
+
method: "GET",
|
|
2197
|
+
headers: {
|
|
2198
|
+
"X-Component": "MoonUIAuthProvider",
|
|
2199
|
+
"X-Timestamp": Date.now().toString()
|
|
2200
|
+
},
|
|
2201
|
+
credentials: "include"
|
|
2202
|
+
});
|
|
2203
|
+
if (response && response.ok) {
|
|
2204
|
+
console.log("[MoonUI Auth] Using CLI auth server");
|
|
2205
|
+
const data = await response.json();
|
|
2206
|
+
const newState = {
|
|
2207
|
+
isLoading: false,
|
|
2208
|
+
hasProAccess: data.hasProAccess || false,
|
|
2209
|
+
isAuthenticated: data.valid || false,
|
|
2210
|
+
subscriptionPlan: data.hasProAccess ? "lifetime" : "free",
|
|
2211
|
+
subscription: {
|
|
2212
|
+
status: data.hasProAccess ? "active" : "inactive",
|
|
2213
|
+
plan: data.hasProAccess ? "lifetime" : "free"
|
|
2214
|
+
},
|
|
2215
|
+
isAdmin: data.isAdmin || false
|
|
2216
|
+
};
|
|
2217
|
+
if (isMounted.current) {
|
|
2218
|
+
setState(newState);
|
|
2219
|
+
}
|
|
2220
|
+
authPromise = null;
|
|
2221
|
+
return newState;
|
|
2222
|
+
} else {
|
|
2223
|
+
throw new Error("Auth server not available");
|
|
2224
|
+
}
|
|
2225
|
+
} catch (error) {
|
|
2226
|
+
console.log('[MoonUI Auth] Auth server not available in development. Run "moonui dev" to enable Pro features.');
|
|
2220
2227
|
}
|
|
2221
|
-
return freeState;
|
|
2222
2228
|
}
|
|
2223
|
-
if (!
|
|
2224
|
-
|
|
2225
|
-
throw new Error(`Validation failed: ${response.status}`);
|
|
2226
|
-
}
|
|
2227
|
-
const data = await response.json();
|
|
2228
|
-
const newState = {
|
|
2229
|
+
if (isProduction || !isDevelopment) ;
|
|
2230
|
+
const freeState = {
|
|
2229
2231
|
isLoading: false,
|
|
2230
|
-
hasProAccess:
|
|
2231
|
-
isAuthenticated:
|
|
2232
|
-
subscriptionPlan:
|
|
2232
|
+
hasProAccess: false,
|
|
2233
|
+
isAuthenticated: false,
|
|
2234
|
+
subscriptionPlan: "free",
|
|
2233
2235
|
subscription: {
|
|
2234
|
-
status:
|
|
2235
|
-
plan:
|
|
2236
|
+
status: "inactive",
|
|
2237
|
+
plan: "free"
|
|
2236
2238
|
},
|
|
2237
|
-
isAdmin:
|
|
2239
|
+
isAdmin: false
|
|
2238
2240
|
};
|
|
2239
2241
|
if (isMounted.current) {
|
|
2240
|
-
setState(
|
|
2242
|
+
setState(freeState);
|
|
2241
2243
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
cached: data.cached
|
|
2245
|
-
});
|
|
2246
|
-
return newState;
|
|
2244
|
+
authPromise = null;
|
|
2245
|
+
return freeState;
|
|
2247
2246
|
} catch (error) {
|
|
2248
2247
|
console.error("[MoonUI Auth] Validation error:", error);
|
|
2249
2248
|
const errorState = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.9",
|
|
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",
|