@moontra/moonui-pro 2.37.10 → 2.37.11

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
@@ -2185,13 +2185,12 @@ function MoonUIAuthProvider({ children }) {
2185
2185
  authPromise = (async () => {
2186
2186
  try {
2187
2187
  lastFetchTime = now;
2188
- const isProduction = false;
2189
- const isDevelopment = true;
2190
- if (isDevelopment) {
2188
+ const isLocalhost = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname.startsWith("192.168.") || window.location.hostname.startsWith("10."));
2189
+ if (isLocalhost) {
2191
2190
  let response;
2192
2191
  const authServerUrl = typeof window !== "undefined" ? process.env.NEXT_PUBLIC_MOONUI_AUTH_SERVER || "http://localhost:7878" : "http://localhost:7878";
2193
2192
  try {
2194
- console.log("[MoonUI Auth] Checking CLI auth server at:", authServerUrl);
2193
+ console.log("[MoonUI Auth] Running on localhost - checking CLI auth server at:", authServerUrl);
2195
2194
  response = await fetch(`${authServerUrl}/validate`, {
2196
2195
  method: "GET",
2197
2196
  headers: {
@@ -2226,7 +2225,64 @@ function MoonUIAuthProvider({ children }) {
2226
2225
  console.log('[MoonUI Auth] Auth server not available in development. Run "moonui dev" to enable Pro features.');
2227
2226
  }
2228
2227
  }
2229
- if (isProduction || !isDevelopment) ;
2228
+ if (!isLocalhost) {
2229
+ const licenseKey = process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || process.env.MOONUI_LICENSE_KEY || process.env.VITE_MOONUI_LICENSE_KEY || process.env.REACT_APP_MOONUI_LICENSE_KEY;
2230
+ if (licenseKey) {
2231
+ console.log("[MoonUI Auth] Running on production domain - validating license key...");
2232
+ try {
2233
+ const currentDomain = typeof window !== "undefined" ? window.location.hostname : process.env.VERCEL_URL || process.env.NEXT_PUBLIC_VERCEL_URL || "";
2234
+ const apiUrl = false ? "https://moonui.dev/api/v1/license/validate" : "https://moonui.dev/api/v1/license/validate";
2235
+ const validationResponse = await fetch(apiUrl, {
2236
+ method: "POST",
2237
+ headers: {
2238
+ "Content-Type": "application/json"
2239
+ },
2240
+ body: JSON.stringify({
2241
+ licenseKey,
2242
+ domain: currentDomain
2243
+ })
2244
+ });
2245
+ if (validationResponse.ok) {
2246
+ const validationData = await validationResponse.json();
2247
+ if (validationData.valid && validationData.hasProAccess) {
2248
+ console.log("[MoonUI Auth] License key validated successfully");
2249
+ const newState = {
2250
+ isLoading: false,
2251
+ hasProAccess: validationData.hasProAccess,
2252
+ isAuthenticated: true,
2253
+ subscriptionPlan: validationData.plan === "lifetime" ? "lifetime" : "free",
2254
+ subscription: {
2255
+ status: validationData.hasProAccess ? "active" : "inactive",
2256
+ plan: validationData.plan === "lifetime" ? "lifetime" : "free"
2257
+ },
2258
+ isAdmin: false
2259
+ };
2260
+ if (typeof document !== "undefined" && validationData.cacheDuration) {
2261
+ const cacheData = {
2262
+ valid: true,
2263
+ hasProAccess: validationData.hasProAccess,
2264
+ timestamp: Date.now()
2265
+ };
2266
+ document.cookie = `moonui_pro_status=${encodeURIComponent(
2267
+ JSON.stringify(cacheData)
2268
+ )}; max-age=${Math.floor(validationData.cacheDuration / 1e3)}; path=/; SameSite=Strict`;
2269
+ }
2270
+ if (isMounted.current) {
2271
+ setState(newState);
2272
+ }
2273
+ authPromise = null;
2274
+ return newState;
2275
+ } else {
2276
+ console.warn("[MoonUI Auth] License key validation failed:", validationData.error || "Invalid license");
2277
+ }
2278
+ } else {
2279
+ console.error("[MoonUI Auth] License validation request failed:", validationResponse.status);
2280
+ }
2281
+ } catch (error) {
2282
+ console.error("[MoonUI Auth] License validation error:", error);
2283
+ }
2284
+ }
2285
+ }
2230
2286
  const freeState = {
2231
2287
  isLoading: false,
2232
2288
  hasProAccess: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.37.10",
3
+ "version": "2.37.11",
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",