@moontra/moonui-pro 2.33.7 → 2.33.8

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
@@ -2771,9 +2771,11 @@ function createAIProvider(provider, config) {
2771
2771
  // src/index.ts
2772
2772
  init_use_subscription();
2773
2773
  var CACHE_KEY2 = "moonui_license_cache";
2774
+ var CLI_AUTH_CACHE_KEY = "moonui_cli_auth_cache";
2774
2775
  var CACHE_DURATION = !process.env.VERCEL ? 1 * 60 * 1e3 : 24 * 60 * 60 * 1e3;
2776
+ var CLI_AUTH_CACHE_DURATION = 60 * 60 * 1e3;
2775
2777
  var OFFLINE_GRACE_PERIOD = !process.env.VERCEL ? 5 * 60 * 1e3 : 7 * 24 * 60 * 60 * 1e3;
2776
- var CHECK_INTERVAL = !process.env.VERCEL ? 10 * 1e3 : 60 * 60 * 1e3;
2778
+ var CHECK_INTERVAL = !process.env.VERCEL ? 60 * 60 * 1e3 : 60 * 60 * 1e3;
2777
2779
  var SubscriptionContext = createContext(void 0);
2778
2780
  function SubscriptionProvider({ children }) {
2779
2781
  const [isLoading, setIsLoading] = useState(true);
@@ -2795,6 +2797,23 @@ function SubscriptionProvider({ children }) {
2795
2797
  const devToken = process.env.NEXT_PUBLIC_MOONUI_DEV_TOKEN;
2796
2798
  const deviceId = process.env.NEXT_PUBLIC_MOONUI_DEVICE_ID;
2797
2799
  if (devToken && deviceId) {
2800
+ const cachedAuth = localStorage.getItem(CLI_AUTH_CACHE_KEY);
2801
+ if (cachedAuth) {
2802
+ try {
2803
+ const cache2 = JSON.parse(cachedAuth);
2804
+ const now = Date.now();
2805
+ if (now - cache2.timestamp < CLI_AUTH_CACHE_DURATION) {
2806
+ console.log("[MoonUI Pro] Using cached CLI auth response");
2807
+ if (cache2.valid && (cache2.plan === "lifetime" || cache2.plan === "pro_lifetime")) {
2808
+ return "cli-authenticated-pro";
2809
+ }
2810
+ return null;
2811
+ }
2812
+ } catch (e) {
2813
+ console.error("[MoonUI Pro] Error parsing CLI auth cache:", e);
2814
+ localStorage.removeItem(CLI_AUTH_CACHE_KEY);
2815
+ }
2816
+ }
2798
2817
  try {
2799
2818
  const decoded = JSON.parse(atob(devToken));
2800
2819
  const jwtToken = decoded.token;
@@ -2822,7 +2841,14 @@ function SubscriptionProvider({ children }) {
2822
2841
  if (response.ok) {
2823
2842
  const data = await response.json();
2824
2843
  console.log("[MoonUI Pro] Response data:", data);
2825
- if (data.valid && data.plan === "pro_lifetime") {
2844
+ const cacheData = {
2845
+ valid: data.valid,
2846
+ plan: data.plan,
2847
+ timestamp: Date.now()
2848
+ };
2849
+ localStorage.setItem(CLI_AUTH_CACHE_KEY, JSON.stringify(cacheData));
2850
+ console.log("[MoonUI Pro] Cached CLI auth response for 1 hour");
2851
+ if (data.valid && (data.plan === "lifetime" || data.plan === "pro_lifetime")) {
2826
2852
  return "cli-authenticated-pro";
2827
2853
  } else if (data.valid) {
2828
2854
  return null;
@@ -2839,6 +2865,7 @@ function SubscriptionProvider({ children }) {
2839
2865
  clearInterval(authCheckInterval);
2840
2866
  setAuthCheckInterval(null);
2841
2867
  }
2868
+ localStorage.removeItem(CLI_AUTH_CACHE_KEY);
2842
2869
  }
2843
2870
  } catch (e) {
2844
2871
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.33.7",
3
+ "version": "2.33.8",
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",