@moontra/moonui-pro 2.37.13 → 2.37.14

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,15 +2185,21 @@ function MoonUIAuthProvider({ children }) {
2185
2185
  authPromise = (async () => {
2186
2186
  try {
2187
2187
  lastFetchTime = now;
2188
- const isProduction = false;
2189
- const isDevelopment = true;
2188
+ const vercelEnv = process.env.VERCEL_ENV;
2189
+ const isVercel = process.env.VERCEL === "1";
2190
+ 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;
2191
+ const isProduction = vercelEnv === "production" || licenseKey && licenseKey.length > 0 || isVercel && vercelEnv !== "development";
2192
+ const isDevelopment = !isProduction;
2190
2193
  console.log("[MoonUI Auth] Environment Detection:", {
2194
+ VERCEL_ENV: vercelEnv,
2195
+ VERCEL: process.env.VERCEL,
2196
+ CI: process.env.CI,
2191
2197
  NODE_ENV: "development",
2198
+ hasLicenseKey: !!licenseKey,
2192
2199
  isProduction,
2193
2200
  isDevelopment,
2194
- window: typeof window !== "undefined" ? "available" : "SSR"
2201
+ environment: isProduction ? "PRODUCTION" : "DEVELOPMENT"
2195
2202
  });
2196
- 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.") : false;
2197
2203
  if (isDevelopment) {
2198
2204
  let response;
2199
2205
  const authServerUrl = typeof window !== "undefined" ? process.env.NEXT_PUBLIC_MOONUI_AUTH_SERVER || "http://localhost:7878" : "http://localhost:7878";
@@ -2233,7 +2239,64 @@ function MoonUIAuthProvider({ children }) {
2233
2239
  console.log('[MoonUI Auth] Auth server not available in development. Run "moonui dev" to enable Pro features.');
2234
2240
  }
2235
2241
  }
2236
- if (isProduction) ;
2242
+ if (isProduction) {
2243
+ const licenseKey2 = 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;
2244
+ if (licenseKey2) {
2245
+ console.log("[MoonUI Auth] Production mode - validating license key...");
2246
+ try {
2247
+ const currentDomain = typeof window !== "undefined" ? window.location.hostname : process.env.VERCEL_URL || process.env.NEXT_PUBLIC_VERCEL_URL || "";
2248
+ const apiUrl = "https://moonui.dev/api/v1/license/validate";
2249
+ const validationResponse = await fetch(apiUrl, {
2250
+ method: "POST",
2251
+ headers: {
2252
+ "Content-Type": "application/json"
2253
+ },
2254
+ body: JSON.stringify({
2255
+ licenseKey: licenseKey2,
2256
+ domain: currentDomain
2257
+ })
2258
+ });
2259
+ if (validationResponse.ok) {
2260
+ const validationData = await validationResponse.json();
2261
+ if (validationData.valid && validationData.hasProAccess) {
2262
+ console.log("[MoonUI Auth] License key validated successfully");
2263
+ const newState = {
2264
+ isLoading: false,
2265
+ hasProAccess: validationData.hasProAccess,
2266
+ isAuthenticated: true,
2267
+ subscriptionPlan: validationData.plan === "lifetime" ? "lifetime" : "free",
2268
+ subscription: {
2269
+ status: validationData.hasProAccess ? "active" : "inactive",
2270
+ plan: validationData.plan === "lifetime" ? "lifetime" : "free"
2271
+ },
2272
+ isAdmin: false
2273
+ };
2274
+ if (typeof document !== "undefined" && validationData.cacheDuration) {
2275
+ const cacheData = {
2276
+ valid: true,
2277
+ hasProAccess: validationData.hasProAccess,
2278
+ timestamp: Date.now()
2279
+ };
2280
+ document.cookie = `moonui_pro_status=${encodeURIComponent(
2281
+ JSON.stringify(cacheData)
2282
+ )}; max-age=${Math.floor(validationData.cacheDuration / 1e3)}; path=/; SameSite=Strict`;
2283
+ }
2284
+ if (isMounted.current) {
2285
+ setState(newState);
2286
+ }
2287
+ authPromise = null;
2288
+ return newState;
2289
+ } else {
2290
+ console.warn("[MoonUI Auth] License key validation failed:", validationData.error || "Invalid license");
2291
+ }
2292
+ } else {
2293
+ console.error("[MoonUI Auth] License validation request failed:", validationResponse.status);
2294
+ }
2295
+ } catch (error) {
2296
+ console.error("[MoonUI Auth] License validation error:", error);
2297
+ }
2298
+ }
2299
+ }
2237
2300
  const freeState = {
2238
2301
  isLoading: false,
2239
2302
  hasProAccess: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.37.13",
3
+ "version": "2.37.14",
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",