@moontra/moonui-pro 2.31.2 → 2.31.3
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.global.js +1 -1
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +35 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4738,17 +4738,22 @@ function useSubscription() {
|
|
|
4738
4738
|
useEffect(() => {
|
|
4739
4739
|
const checkLicense = async () => {
|
|
4740
4740
|
try {
|
|
4741
|
+
console.log("[MoonUI Pro] Starting license check...");
|
|
4742
|
+
console.log("[MoonUI Pro] Environment:", "development");
|
|
4741
4743
|
const cached = localStorage.getItem(CACHE_KEY);
|
|
4742
4744
|
if (cached) {
|
|
4743
4745
|
const cacheData = JSON.parse(cached);
|
|
4744
4746
|
const now = Date.now();
|
|
4747
|
+
console.log("[MoonUI Pro] Cache found:", cacheData);
|
|
4745
4748
|
if (now - cacheData.timestamp < CACHE_DURATION) {
|
|
4749
|
+
console.log("[MoonUI Pro] Using valid cache");
|
|
4746
4750
|
setHasProAccess(cacheData.valid && cacheData.hasLifetimeAccess);
|
|
4747
4751
|
setIsAuthenticated(cacheData.valid);
|
|
4748
4752
|
setIsLoading(false);
|
|
4749
4753
|
return;
|
|
4750
4754
|
}
|
|
4751
4755
|
if (now - cacheData.timestamp < OFFLINE_GRACE_PERIOD) {
|
|
4756
|
+
console.log("[MoonUI Pro] Cache expired but within grace period");
|
|
4752
4757
|
validateLicense().catch(() => {
|
|
4753
4758
|
setHasProAccess(cacheData.valid && cacheData.hasLifetimeAccess);
|
|
4754
4759
|
setIsAuthenticated(cacheData.valid);
|
|
@@ -4757,9 +4762,10 @@ function useSubscription() {
|
|
|
4757
4762
|
return;
|
|
4758
4763
|
}
|
|
4759
4764
|
}
|
|
4765
|
+
console.log("[MoonUI Pro] No valid cache, validating license...");
|
|
4760
4766
|
await validateLicense();
|
|
4761
4767
|
} catch (error) {
|
|
4762
|
-
console.error("License check error:", error);
|
|
4768
|
+
console.error("[MoonUI Pro] License check error:", error);
|
|
4763
4769
|
setHasProAccess(false);
|
|
4764
4770
|
setIsAuthenticated(false);
|
|
4765
4771
|
} finally {
|
|
@@ -4769,11 +4775,29 @@ function useSubscription() {
|
|
|
4769
4775
|
checkLicense();
|
|
4770
4776
|
}, []);
|
|
4771
4777
|
const getAuthToken = async () => {
|
|
4778
|
+
const isDevelopment = true;
|
|
4779
|
+
const isProduction = false;
|
|
4780
|
+
console.log("[MoonUI Pro] Getting auth token, isDevelopment:", isDevelopment, "isProduction:", isProduction);
|
|
4772
4781
|
{
|
|
4773
4782
|
if (typeof window !== "undefined") {
|
|
4774
4783
|
const browserToken = localStorage.getItem("moonui_auth_token");
|
|
4775
|
-
if (browserToken)
|
|
4784
|
+
if (browserToken) {
|
|
4785
|
+
console.log("[MoonUI Pro] Found browser token");
|
|
4776
4786
|
return browserToken;
|
|
4787
|
+
}
|
|
4788
|
+
try {
|
|
4789
|
+
const response = await fetch("/api/moonui/check-cli-auth");
|
|
4790
|
+
if (response.ok) {
|
|
4791
|
+
const data = await response.json();
|
|
4792
|
+
console.log("[MoonUI Pro] CLI auth check response:", data);
|
|
4793
|
+
if (data.authenticated) {
|
|
4794
|
+
console.log("[MoonUI Pro] CLI authenticated via API");
|
|
4795
|
+
return "cli-authenticated";
|
|
4796
|
+
}
|
|
4797
|
+
}
|
|
4798
|
+
} catch (error) {
|
|
4799
|
+
console.log("[MoonUI Pro] CLI auth check via API failed:", error);
|
|
4800
|
+
}
|
|
4777
4801
|
}
|
|
4778
4802
|
if (typeof window === "undefined") {
|
|
4779
4803
|
try {
|
|
@@ -4782,23 +4806,29 @@ function useSubscription() {
|
|
|
4782
4806
|
const os2 = __require("os");
|
|
4783
4807
|
const authPath = path.join(os2.homedir(), ".moonui", "auth.encrypted");
|
|
4784
4808
|
if (fs.existsSync(authPath)) {
|
|
4809
|
+
console.log("[MoonUI Pro] CLI authenticated (server-side)");
|
|
4785
4810
|
return "cli-authenticated";
|
|
4786
4811
|
}
|
|
4787
4812
|
} catch (error) {
|
|
4788
|
-
console.debug("CLI auth check failed:", error);
|
|
4813
|
+
console.debug("[MoonUI Pro] Server-side CLI auth check failed:", error);
|
|
4789
4814
|
}
|
|
4790
4815
|
}
|
|
4791
4816
|
}
|
|
4792
|
-
|
|
4817
|
+
const envToken = process.env.NEXT_PUBLIC_MOONUI_AUTH_TOKEN || process.env.MOONUI_LICENSE_KEY || null;
|
|
4818
|
+
console.log("[MoonUI Pro] Fallback env token:", envToken ? "found" : "not found");
|
|
4819
|
+
return envToken;
|
|
4793
4820
|
};
|
|
4794
4821
|
const validateLicense = async () => {
|
|
4795
4822
|
const token = await getAuthToken();
|
|
4823
|
+
console.log("[MoonUI Pro] Validating license with token:", token ? token.substring(0, 20) + "..." : "null");
|
|
4796
4824
|
if (!token) {
|
|
4825
|
+
console.log("[MoonUI Pro] No token found, denying access");
|
|
4797
4826
|
setHasProAccess(false);
|
|
4798
4827
|
setIsAuthenticated(false);
|
|
4799
4828
|
return;
|
|
4800
4829
|
}
|
|
4801
4830
|
if (token === "cli-authenticated") {
|
|
4831
|
+
console.log("[MoonUI Pro] CLI authenticated, granting access");
|
|
4802
4832
|
setHasProAccess(true);
|
|
4803
4833
|
setIsAuthenticated(true);
|
|
4804
4834
|
if (typeof window !== "undefined") {
|
|
@@ -4808,6 +4838,7 @@ function useSubscription() {
|
|
|
4808
4838
|
timestamp: Date.now()
|
|
4809
4839
|
};
|
|
4810
4840
|
localStorage.setItem(CACHE_KEY, JSON.stringify(cacheData));
|
|
4841
|
+
console.log("[MoonUI Pro] Cached CLI auth");
|
|
4811
4842
|
}
|
|
4812
4843
|
return;
|
|
4813
4844
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.31.
|
|
3
|
+
"version": "2.31.3",
|
|
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",
|