@moontra/moonui-pro 2.33.8 → 2.33.10

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.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 - stopping retry attempts");
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) {
@@ -2875,6 +2867,7 @@ function SubscriptionProvider({ children }) {
2875
2867
  console.debug("[MoonUI Pro Context] CLI auth check via moonui.dev failed:", error);
2876
2868
  }
2877
2869
  }
2870
+ return null;
2878
2871
  }
2879
2872
  }
2880
2873
  }
@@ -2948,17 +2941,45 @@ function SubscriptionProvider({ children }) {
2948
2941
  }
2949
2942
  setLastCheckTime(now);
2950
2943
  try {
2944
+ if (true) {
2945
+ const cliCached = localStorage.getItem(CLI_AUTH_CACHE_KEY);
2946
+ if (cliCached) {
2947
+ try {
2948
+ const cliCache = JSON.parse(cliCached);
2949
+ if (now - cliCache.timestamp < CLI_AUTH_CACHE_DURATION) {
2950
+ console.log("[MoonUI Pro] Using cached CLI auth from checkAccess");
2951
+ if (cliCache.valid && (cliCache.plan === "lifetime" || cliCache.plan === "pro_lifetime")) {
2952
+ setHasProAccess(true);
2953
+ setIsAuthenticated(true);
2954
+ setIsLoading(false);
2955
+ return;
2956
+ }
2957
+ }
2958
+ } catch (e) {
2959
+ console.error("[MoonUI Pro] Error parsing CLI auth cache:", e);
2960
+ localStorage.removeItem(CLI_AUTH_CACHE_KEY);
2961
+ }
2962
+ }
2963
+ console.log("[MoonUI Pro] No valid CLI cache, checking CLI auth...");
2964
+ const authToken = await getAuthToken2();
2965
+ if (authToken === "cli-authenticated-pro") {
2966
+ console.log("[MoonUI Pro] CLI authentication successful");
2967
+ setHasProAccess(true);
2968
+ setIsAuthenticated(true);
2969
+ setIsLoading(false);
2970
+ return;
2971
+ }
2972
+ }
2951
2973
  const cached = localStorage.getItem(CACHE_KEY2);
2952
2974
  if (cached) {
2953
2975
  const cacheData = JSON.parse(cached);
2954
- const now2 = Date.now();
2955
- if (now2 - cacheData.timestamp < CACHE_DURATION) {
2976
+ if (now - cacheData.timestamp < CACHE_DURATION) {
2956
2977
  setHasProAccess(cacheData.valid && cacheData.hasLifetimeAccess);
2957
2978
  setIsAuthenticated(cacheData.valid);
2958
2979
  setIsLoading(false);
2959
2980
  return;
2960
2981
  }
2961
- if (now2 - cacheData.timestamp < OFFLINE_GRACE_PERIOD) {
2982
+ if (now - cacheData.timestamp < OFFLINE_GRACE_PERIOD) {
2962
2983
  validateLicense2().catch(() => {
2963
2984
  setHasProAccess(cacheData.valid && cacheData.hasLifetimeAccess);
2964
2985
  setIsAuthenticated(cacheData.valid);
@@ -2978,25 +2999,7 @@ function SubscriptionProvider({ children }) {
2978
2999
  };
2979
3000
  useEffect(() => {
2980
3001
  checkAccess();
2981
- if (!hasAuthError) {
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]);
3002
+ }, []);
3000
3003
  const value = {
3001
3004
  isLoading,
3002
3005
  hasProAccess,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.33.8",
3
+ "version": "2.33.10",
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",