@moontra/moonui-pro 2.33.8 → 2.33.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/index.global.js +52 -52
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +24 -31
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2775,15 +2775,12 @@ var CLI_AUTH_CACHE_KEY = "moonui_cli_auth_cache";
|
|
|
2775
2775
|
var CACHE_DURATION = !process.env.VERCEL ? 1 * 60 * 1e3 : 24 * 60 * 60 * 1e3;
|
|
2776
2776
|
var CLI_AUTH_CACHE_DURATION = 60 * 60 * 1e3;
|
|
2777
2777
|
var OFFLINE_GRACE_PERIOD = !process.env.VERCEL ? 5 * 60 * 1e3 : 7 * 24 * 60 * 60 * 1e3;
|
|
2778
|
-
var CHECK_INTERVAL = !process.env.VERCEL ? 60 * 60 * 1e3 : 60 * 60 * 1e3;
|
|
2779
2778
|
var SubscriptionContext = createContext(void 0);
|
|
2780
2779
|
function SubscriptionProvider({ children }) {
|
|
2781
2780
|
const [isLoading, setIsLoading] = useState(true);
|
|
2782
2781
|
const [hasProAccess, setHasProAccess] = useState(false);
|
|
2783
2782
|
const [isAuthenticated, setIsAuthenticated] = useState(false);
|
|
2784
2783
|
const [lastCheckTime, setLastCheckTime] = useState(0);
|
|
2785
|
-
const [authCheckInterval, setAuthCheckInterval] = useState(null);
|
|
2786
|
-
const [hasAuthError, setHasAuthError] = useState(false);
|
|
2787
2784
|
const getAuthToken2 = async () => {
|
|
2788
2785
|
if (process.env.VERCEL) {
|
|
2789
2786
|
return process.env.NEXT_PUBLIC_MOONUI_AUTH_TOKEN || process.env.MOONUI_LICENSE_KEY || null;
|
|
@@ -2859,12 +2856,7 @@ function SubscriptionProvider({ children }) {
|
|
|
2859
2856
|
try {
|
|
2860
2857
|
const errorObj = JSON.parse(errorData);
|
|
2861
2858
|
if (errorObj.reason === "browser-fingerprint-invalid" || errorObj.reason === "cli-session-missing" || response.status === 401) {
|
|
2862
|
-
console.error("[MoonUI Pro] Critical auth error
|
|
2863
|
-
setHasAuthError(true);
|
|
2864
|
-
if (authCheckInterval) {
|
|
2865
|
-
clearInterval(authCheckInterval);
|
|
2866
|
-
setAuthCheckInterval(null);
|
|
2867
|
-
}
|
|
2859
|
+
console.error("[MoonUI Pro] Critical auth error");
|
|
2868
2860
|
localStorage.removeItem(CLI_AUTH_CACHE_KEY);
|
|
2869
2861
|
}
|
|
2870
2862
|
} catch (e) {
|
|
@@ -2948,17 +2940,36 @@ function SubscriptionProvider({ children }) {
|
|
|
2948
2940
|
}
|
|
2949
2941
|
setLastCheckTime(now);
|
|
2950
2942
|
try {
|
|
2943
|
+
if (true) {
|
|
2944
|
+
const cliCached = localStorage.getItem(CLI_AUTH_CACHE_KEY);
|
|
2945
|
+
if (cliCached) {
|
|
2946
|
+
try {
|
|
2947
|
+
const cliCache = JSON.parse(cliCached);
|
|
2948
|
+
if (now - cliCache.timestamp < CLI_AUTH_CACHE_DURATION) {
|
|
2949
|
+
console.log("[MoonUI Pro] Using cached CLI auth from checkAccess");
|
|
2950
|
+
if (cliCache.valid && (cliCache.plan === "lifetime" || cliCache.plan === "pro_lifetime")) {
|
|
2951
|
+
setHasProAccess(true);
|
|
2952
|
+
setIsAuthenticated(true);
|
|
2953
|
+
setIsLoading(false);
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
} catch (e) {
|
|
2958
|
+
console.error("[MoonUI Pro] Error parsing CLI auth cache:", e);
|
|
2959
|
+
localStorage.removeItem(CLI_AUTH_CACHE_KEY);
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2951
2963
|
const cached = localStorage.getItem(CACHE_KEY2);
|
|
2952
2964
|
if (cached) {
|
|
2953
2965
|
const cacheData = JSON.parse(cached);
|
|
2954
|
-
|
|
2955
|
-
if (now2 - cacheData.timestamp < CACHE_DURATION) {
|
|
2966
|
+
if (now - cacheData.timestamp < CACHE_DURATION) {
|
|
2956
2967
|
setHasProAccess(cacheData.valid && cacheData.hasLifetimeAccess);
|
|
2957
2968
|
setIsAuthenticated(cacheData.valid);
|
|
2958
2969
|
setIsLoading(false);
|
|
2959
2970
|
return;
|
|
2960
2971
|
}
|
|
2961
|
-
if (
|
|
2972
|
+
if (now - cacheData.timestamp < OFFLINE_GRACE_PERIOD) {
|
|
2962
2973
|
validateLicense2().catch(() => {
|
|
2963
2974
|
setHasProAccess(cacheData.valid && cacheData.hasLifetimeAccess);
|
|
2964
2975
|
setIsAuthenticated(cacheData.valid);
|
|
@@ -2978,25 +2989,7 @@ function SubscriptionProvider({ children }) {
|
|
|
2978
2989
|
};
|
|
2979
2990
|
useEffect(() => {
|
|
2980
2991
|
checkAccess();
|
|
2981
|
-
|
|
2982
|
-
const interval = setInterval(() => {
|
|
2983
|
-
if (!hasAuthError) {
|
|
2984
|
-
console.log("[MoonUI Pro] Running periodic auth check...");
|
|
2985
|
-
validateLicense2().catch((error) => {
|
|
2986
|
-
console.error("[MoonUI Pro] Periodic auth check failed:", error);
|
|
2987
|
-
});
|
|
2988
|
-
} else {
|
|
2989
|
-
console.log("[MoonUI Pro] Auth check disabled due to critical error");
|
|
2990
|
-
clearInterval(interval);
|
|
2991
|
-
}
|
|
2992
|
-
}, CHECK_INTERVAL);
|
|
2993
|
-
setAuthCheckInterval(interval);
|
|
2994
|
-
return () => {
|
|
2995
|
-
if (interval)
|
|
2996
|
-
clearInterval(interval);
|
|
2997
|
-
};
|
|
2998
|
-
}
|
|
2999
|
-
}, [hasAuthError]);
|
|
2992
|
+
}, []);
|
|
3000
2993
|
const value = {
|
|
3001
2994
|
isLoading,
|
|
3002
2995
|
hasProAccess,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.33.
|
|
3
|
+
"version": "2.33.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",
|