@moontra/moonui-pro 2.31.4 → 2.31.6

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
@@ -50,14 +50,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
50
50
  var __getOwnPropNames = Object.getOwnPropertyNames;
51
51
  var __getProtoOf = Object.getPrototypeOf;
52
52
  var __hasOwnProp = Object.prototype.hasOwnProperty;
53
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
54
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
55
- }) : x)(function(x) {
56
- if (typeof require !== "undefined")
57
- return require.apply(this, arguments);
58
- throw new Error('Dynamic require of "' + x + '" is not supported');
59
- });
60
- var __commonJS = (cb, mod) => function __require2() {
53
+ var __commonJS = (cb, mod) => function __require() {
61
54
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
62
55
  };
63
56
  var __copyProps = (to, from2, except, desc) => {
@@ -2059,8 +2052,9 @@ function createAIProvider(provider, config) {
2059
2052
  }
2060
2053
  }
2061
2054
  var CACHE_KEY = "moonui_license_cache";
2062
- var CACHE_DURATION = 24 * 60 * 60 * 1e3;
2063
- var OFFLINE_GRACE_PERIOD = 7 * 24 * 60 * 60 * 1e3;
2055
+ var CACHE_DURATION = 1 * 60 * 1e3 ;
2056
+ var OFFLINE_GRACE_PERIOD = 5 * 60 * 1e3 ;
2057
+ var CHECK_INTERVAL = 10 * 1e3;
2064
2058
  var SubscriptionContext = createContext(void 0);
2065
2059
  function SubscriptionProvider({ children }) {
2066
2060
  const [isLoading, setIsLoading] = useState(true);
@@ -2078,38 +2072,31 @@ function SubscriptionProvider({ children }) {
2078
2072
  const response = await fetch("/api/moonui/check-cli-auth");
2079
2073
  if (response.ok) {
2080
2074
  const data = await response.json();
2081
- if (data.authenticated) {
2082
- return "cli-authenticated";
2075
+ if (data.authenticated && data.hasProAccess) {
2076
+ return "cli-authenticated-pro";
2077
+ } else if (data.authenticated) {
2078
+ return null;
2083
2079
  }
2084
2080
  }
2085
2081
  } catch (error) {
2086
2082
  console.debug("[MoonUI Pro Context] CLI auth check via API failed:", error);
2087
2083
  }
2088
2084
  }
2089
- if (typeof window === "undefined") {
2090
- try {
2091
- const fs = __require("fs");
2092
- const path = __require("path");
2093
- const os2 = __require("os");
2094
- const authPath = path.join(os2.homedir(), ".moonui", "auth.encrypted");
2095
- if (fs.existsSync(authPath)) {
2096
- return "cli-authenticated";
2097
- }
2098
- } catch (error) {
2099
- console.debug("[MoonUI Pro Context] Server-side CLI auth check failed:", error);
2100
- }
2101
- }
2102
2085
  }
2103
2086
  return process.env.NEXT_PUBLIC_MOONUI_AUTH_TOKEN || process.env.MOONUI_LICENSE_KEY || null;
2104
2087
  };
2105
2088
  const validateLicense = async () => {
2106
2089
  const token = await getAuthToken();
2107
2090
  if (!token) {
2091
+ console.log("[MoonUI Pro] No auth token found - clearing access");
2092
+ if (typeof window !== "undefined") {
2093
+ localStorage.removeItem(CACHE_KEY);
2094
+ }
2108
2095
  setHasProAccess(false);
2109
2096
  setIsAuthenticated(false);
2110
2097
  return;
2111
2098
  }
2112
- if (token === "cli-authenticated") {
2099
+ if (token === "cli-authenticated-pro") {
2113
2100
  setHasProAccess(true);
2114
2101
  setIsAuthenticated(true);
2115
2102
  if (typeof window !== "undefined") {
@@ -2196,6 +2183,16 @@ function SubscriptionProvider({ children }) {
2196
2183
  };
2197
2184
  useEffect(() => {
2198
2185
  checkAccess();
2186
+ {
2187
+ const interval = setInterval(() => {
2188
+ console.log("[MoonUI Pro] Running periodic auth check...");
2189
+ if (typeof window !== "undefined") {
2190
+ localStorage.removeItem(CACHE_KEY);
2191
+ }
2192
+ validateLicense().catch(console.error);
2193
+ }, CHECK_INTERVAL);
2194
+ return () => clearInterval(interval);
2195
+ }
2199
2196
  }, []);
2200
2197
  const value = {
2201
2198
  isLoading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.31.4",
3
+ "version": "2.31.6",
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",