@moontra/moonui-pro 3.3.4 → 3.3.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
@@ -2118,6 +2118,21 @@ var AUTH_CONFIG = {
2118
2118
  // src/lib/license-token-client.ts
2119
2119
  function readLicenseTokenClient() {
2120
2120
  try {
2121
+ const envToken = process.env.NEXT_PUBLIC_MOONUI_PRO_TOKEN;
2122
+ if (envToken) {
2123
+ try {
2124
+ const decodedToken = typeof window !== "undefined" ? atob(envToken) : Buffer.from(envToken, "base64").toString("utf8");
2125
+ const token2 = JSON.parse(decodedToken);
2126
+ if (token2.expiresAt < Date.now()) {
2127
+ console.log("[MoonUI] Environment license token expired");
2128
+ } else {
2129
+ console.log("[MoonUI] Using environment license token (production)");
2130
+ return token2;
2131
+ }
2132
+ } catch (error) {
2133
+ console.error("[MoonUI] Error parsing environment token:", error);
2134
+ }
2135
+ }
2121
2136
  if (typeof window === "undefined" || !window.localStorage) {
2122
2137
  return null;
2123
2138
  }
@@ -2131,6 +2146,7 @@ function readLicenseTokenClient() {
2131
2146
  localStorage.removeItem("moonui_license_token");
2132
2147
  return null;
2133
2148
  }
2149
+ console.log("[MoonUI] Using localStorage license token (development)");
2134
2150
  return token;
2135
2151
  } catch (error) {
2136
2152
  console.error("[MoonUI] Error reading client license token:", error);
@@ -2260,12 +2276,12 @@ function MoonUIAuthProvider({ children }) {
2260
2276
  );
2261
2277
  const freeState = {
2262
2278
  isLoading: false,
2263
- hasProAccess: true,
2264
- isAuthenticated: true,
2265
- subscriptionPlan: "lifetime",
2279
+ hasProAccess: false,
2280
+ isAuthenticated: false,
2281
+ subscriptionPlan: "free",
2266
2282
  subscription: {
2267
- status: "active",
2268
- plan: "lifetime"
2283
+ status: "inactive",
2284
+ plan: "free"
2269
2285
  },
2270
2286
  isAdmin: false
2271
2287
  };
@@ -2278,12 +2294,12 @@ function MoonUIAuthProvider({ children }) {
2278
2294
  console.error("[MoonUI Auth] Validation error:", error);
2279
2295
  const errorState = {
2280
2296
  isLoading: false,
2281
- hasProAccess: true,
2282
- isAuthenticated: true,
2283
- subscriptionPlan: "lifetime",
2297
+ hasProAccess: false,
2298
+ isAuthenticated: false,
2299
+ subscriptionPlan: "free",
2284
2300
  subscription: {
2285
- status: "active",
2286
- plan: "lifetime"
2301
+ status: "inactive",
2302
+ plan: "free"
2287
2303
  },
2288
2304
  isAdmin: false
2289
2305
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "3.3.4",
3
+ "version": "3.3.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",
@@ -88,6 +88,7 @@
88
88
  "react-dom": ">=18.0.0 || ^19.0.0"
89
89
  },
90
90
  "dependencies": {
91
+ "@moontra/moonui-pro": "^3.3.5",
91
92
  "@radix-ui/react-accordion": "^1.2.11",
92
93
  "@radix-ui/react-avatar": "^1.1.10",
93
94
  "@radix-ui/react-checkbox": "^1.3.2",
@@ -138,25 +138,34 @@ function saveLicenseToken(token) {
138
138
  if (isVercelBuild || isNetlifyBuild) {
139
139
  console.log('[MoonUI Pro] Detected build environment:', isVercelBuild ? 'Vercel' : 'Netlify');
140
140
 
141
- // In Vercel/Netlify, we can't write files persistently
142
- // Instead, we'll set an environment variable that the build can use
141
+ // Token'ı hem environment variable'a hem de dosyaya kaydet
143
142
  const tokenString = JSON.stringify(token);
144
143
  const base64Token = Buffer.from(tokenString).toString('base64');
145
144
 
145
+ // 1. Environment variable (geçici - sadece PostInstall process'i için)
146
146
  console.log('[MoonUI Pro] Setting MOONUI_PRO_TOKEN environment variable for build...');
147
147
  process.env.MOONUI_PRO_TOKEN = base64Token;
148
148
 
149
- // Also try to write to a temp location that might be available during build
149
+ // 2. Project root'a kalıcı dosya (next.config.ts build time'da okuyacak)
150
150
  try {
151
- const tempPath = process.env.VERCEL_ARTIFACTS_PATH || process.env.NETLIFY_BUILD_BASE || '/tmp';
152
- const tempLicenseFile = path.join(tempPath, LICENSE_FILE);
151
+ // Project root'u bul (node_modules'dan 2 seviye yukarı)
152
+ const projectRoot = path.resolve(process.cwd(), '../..');
153
+ const tokenFile = path.join(projectRoot, '.moonui-license-token');
154
+
155
+ console.log('[MoonUI Pro] Saving token to project root:', tokenFile);
156
+ fs.writeFileSync(tokenFile, base64Token, 'utf8');
157
+ console.log('[MoonUI Pro] ✓ Token saved to project root');
158
+ } catch (fileError) {
159
+ console.error('[MoonUI Pro] Failed to save token file:', fileError.message);
160
+ }
153
161
 
154
- // Encrypt token with a deterministic key based on environment
155
- const encryptionKey = process.env.MOONUI_LICENSE_KEY || 'default-key';
156
- const encryptedData = encryptToken(token, encryptionKey);
162
+ // 3. Temp location (fallback)
163
+ try {
164
+ const tempPath = process.env.VERCEL_ARTIFACTS_PATH || process.env.NETLIFY_BUILD_BASE || '/tmp';
165
+ const tempLicenseFile = path.join(tempPath, '.moonui-license-token');
157
166
 
158
- fs.writeFileSync(tempLicenseFile, JSON.stringify(encryptedData, null, 2));
159
- console.log('[MoonUI Pro] Token saved to temporary location:', tempLicenseFile);
167
+ fs.writeFileSync(tempLicenseFile, base64Token, 'utf8');
168
+ console.log('[MoonUI Pro] Token also saved to temp location:', tempLicenseFile);
160
169
  } catch (tempError) {
161
170
  console.log('[MoonUI Pro] Could not write to temp location (expected in some environments)');
162
171
  }