@moontra/moonui-pro 3.3.3 → 3.3.5

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);
@@ -2178,40 +2194,27 @@ function MoonUIAuthProvider({ children }) {
2178
2194
  authPromise = (async () => {
2179
2195
  try {
2180
2196
  lastFetchTime = now;
2181
- const licenseToken = readLicenseTokenClient();
2182
- if (licenseToken && licenseToken.hasProAccess) {
2183
- console.log("[MoonUI Auth] Using embedded license token - Pro access granted");
2184
- const tokenState = {
2185
- isLoading: false,
2186
- hasProAccess: true,
2187
- isAuthenticated: true,
2188
- subscriptionPlan: licenseToken.plan === "lifetime" ? "lifetime" : "free",
2189
- subscription: {
2190
- status: "active",
2191
- plan: licenseToken.plan === "lifetime" ? "lifetime" : "free"
2192
- },
2193
- isAdmin: false
2194
- };
2195
- if (isMounted.current) {
2196
- setState(tokenState);
2197
- }
2198
- authPromise = null;
2199
- return tokenState;
2200
- }
2201
2197
  const isLocalhost = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
2202
2198
  if (isLocalhost) {
2203
2199
  try {
2204
- console.log("[MoonUI Auth] Development mode - checking CLI auth server");
2205
- const response = await fetch("http://localhost:7878/validate", {
2206
- method: "GET",
2207
- headers: {
2208
- "X-Component": "MoonUIAuthProvider",
2209
- "X-Timestamp": Date.now().toString()
2210
- },
2211
- credentials: "include"
2212
- });
2200
+ console.log(
2201
+ "[MoonUI Auth] Development mode - checking CLI auth server"
2202
+ );
2203
+ const response = await fetch(
2204
+ "http://localhost:7878/validate",
2205
+ {
2206
+ method: "GET",
2207
+ headers: {
2208
+ "X-Component": "MoonUIAuthProvider",
2209
+ "X-Timestamp": Date.now().toString()
2210
+ },
2211
+ credentials: "include"
2212
+ }
2213
+ );
2213
2214
  if (response && response.ok) {
2214
- console.log("[MoonUI Auth] CLI auth server available");
2215
+ console.log(
2216
+ "[MoonUI Auth] CLI auth server available"
2217
+ );
2215
2218
  const data = await response.json();
2216
2219
  if (data.valid && data.hasProAccess) {
2217
2220
  saveLicenseTokenClient({
@@ -2241,10 +2244,36 @@ function MoonUIAuthProvider({ children }) {
2241
2244
  return newState;
2242
2245
  }
2243
2246
  } catch (error) {
2244
- console.log('[MoonUI Auth] CLI auth server not available. Run "moonui dev" to enable Pro features.');
2247
+ console.log(
2248
+ '[MoonUI Auth] CLI auth server not available. Run "moonui dev" to enable Pro features.'
2249
+ );
2245
2250
  }
2246
2251
  }
2247
- console.log("[MoonUI Auth] No authentication available - using free plan");
2252
+ const licenseToken = readLicenseTokenClient();
2253
+ if (licenseToken && licenseToken.hasProAccess) {
2254
+ console.log(
2255
+ "[MoonUI Auth] Using embedded license token - Pro access granted"
2256
+ );
2257
+ const tokenState = {
2258
+ isLoading: false,
2259
+ hasProAccess: true,
2260
+ isAuthenticated: true,
2261
+ subscriptionPlan: licenseToken.plan === "lifetime" ? "lifetime" : "free",
2262
+ subscription: {
2263
+ status: "active",
2264
+ plan: licenseToken.plan === "lifetime" ? "lifetime" : "free"
2265
+ },
2266
+ isAdmin: false
2267
+ };
2268
+ if (isMounted.current) {
2269
+ setState(tokenState);
2270
+ }
2271
+ authPromise = null;
2272
+ return tokenState;
2273
+ }
2274
+ console.log(
2275
+ "[MoonUI Auth] No authentication available - using free plan"
2276
+ );
2248
2277
  const freeState = {
2249
2278
  isLoading: false,
2250
2279
  hasProAccess: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
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",