@moontra/moonui-pro 2.37.2 → 2.37.3
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 +1 -1
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.mjs +28 -8
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2353,7 +2353,27 @@ function useSubscription() {
|
|
|
2353
2353
|
}
|
|
2354
2354
|
return null;
|
|
2355
2355
|
}, []);
|
|
2356
|
-
const
|
|
2356
|
+
const validateWithAuthServer = useCallback(async () => {
|
|
2357
|
+
try {
|
|
2358
|
+
const authServerUrl = process.env.NEXT_PUBLIC_MOONUI_AUTH_SERVER || "http://localhost:7878";
|
|
2359
|
+
console.log("[Client Auth] Checking CLI auth server...");
|
|
2360
|
+
const authServerResponse = await fetch(`${authServerUrl}/validate`, {
|
|
2361
|
+
method: "GET",
|
|
2362
|
+
headers: {
|
|
2363
|
+
"X-Component": "useSubscription",
|
|
2364
|
+
"X-Timestamp": Date.now().toString()
|
|
2365
|
+
},
|
|
2366
|
+
credentials: "include"
|
|
2367
|
+
}).catch(() => null);
|
|
2368
|
+
if (authServerResponse && authServerResponse.ok) {
|
|
2369
|
+
const data = await authServerResponse.json();
|
|
2370
|
+
console.log("[Client Auth] CLI auth server response:", data);
|
|
2371
|
+
return data;
|
|
2372
|
+
}
|
|
2373
|
+
console.log("[Client Auth] CLI auth server not available, falling back...");
|
|
2374
|
+
} catch (error) {
|
|
2375
|
+
console.log("[Client Auth] CLI auth server error:", error);
|
|
2376
|
+
}
|
|
2357
2377
|
try {
|
|
2358
2378
|
console.log("[Client Auth] Validating with internal API...");
|
|
2359
2379
|
const response = await fetch(AUTH_CONFIG.internalEndpoint, {
|
|
@@ -2416,23 +2436,23 @@ function useSubscription() {
|
|
|
2416
2436
|
});
|
|
2417
2437
|
if (age > maxAge * AUTH_CONFIG.cache.refreshThreshold) {
|
|
2418
2438
|
console.log("[Client Auth] Refreshing validation in background...");
|
|
2419
|
-
|
|
2439
|
+
validateWithAuthServer();
|
|
2420
2440
|
}
|
|
2421
2441
|
return;
|
|
2422
2442
|
}
|
|
2423
2443
|
}
|
|
2424
|
-
|
|
2425
|
-
}, [readValidationFromCookie,
|
|
2444
|
+
validateWithAuthServer();
|
|
2445
|
+
}, [readValidationFromCookie, validateWithAuthServer]);
|
|
2426
2446
|
useEffect(() => {
|
|
2427
2447
|
const handleStorageChange = (e) => {
|
|
2428
2448
|
if (e.key === "moonui_pro_refresh") {
|
|
2429
2449
|
console.log("[Client Auth] Refresh signal from another tab");
|
|
2430
|
-
|
|
2450
|
+
validateWithAuthServer();
|
|
2431
2451
|
}
|
|
2432
2452
|
};
|
|
2433
2453
|
window.addEventListener("storage", handleStorageChange);
|
|
2434
2454
|
return () => window.removeEventListener("storage", handleStorageChange);
|
|
2435
|
-
}, [
|
|
2455
|
+
}, [validateWithAuthServer]);
|
|
2436
2456
|
useEffect(() => {
|
|
2437
2457
|
let lastCheck = Date.now();
|
|
2438
2458
|
const handleFocus = () => {
|
|
@@ -2441,12 +2461,12 @@ function useSubscription() {
|
|
|
2441
2461
|
if (timeSinceLastCheck > 5 * 60 * 1e3) {
|
|
2442
2462
|
console.log("[Client Auth] Window focused, checking validation...");
|
|
2443
2463
|
lastCheck = now;
|
|
2444
|
-
|
|
2464
|
+
validateWithAuthServer();
|
|
2445
2465
|
}
|
|
2446
2466
|
};
|
|
2447
2467
|
window.addEventListener("focus", handleFocus);
|
|
2448
2468
|
return () => window.removeEventListener("focus", handleFocus);
|
|
2449
|
-
}, [
|
|
2469
|
+
}, [validateWithAuthServer]);
|
|
2450
2470
|
return state;
|
|
2451
2471
|
}
|
|
2452
2472
|
async function forceRefresh() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.37.
|
|
3
|
+
"version": "2.37.3",
|
|
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",
|