@moontra/moonui-pro 2.32.44 → 2.33.1

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
@@ -99,87 +99,6 @@ var init_cli_token_reader = __esm({
99
99
  }
100
100
  return this.instance;
101
101
  }
102
- /**
103
- * Get real external IP address using WebRTC (browser-native method)
104
- * This ensures browser and CLI use the same IP perspective
105
- */
106
- async getRealExternalIP() {
107
- try {
108
- console.log("[MoonUI Pro] Starting real external IP detection...");
109
- const ip = await this.getWebRTCIP();
110
- console.log("[MoonUI Pro] WebRTC returned IP:", ip);
111
- if (ip && ip !== "unknown") {
112
- console.log("[MoonUI Pro] Using WebRTC IP:", ip);
113
- return ip;
114
- }
115
- if (typeof window !== "undefined") {
116
- const currentHost = window.location.hostname;
117
- console.log("[MoonUI Pro] Fallback hostname check:", currentHost);
118
- if (currentHost !== "localhost" && currentHost !== "127.0.0.1") {
119
- console.log("[MoonUI Pro] Using fallback hostname:", currentHost);
120
- return currentHost;
121
- }
122
- }
123
- console.log("[MoonUI Pro] Using last resort IP: 192.168.1.2");
124
- return "192.168.1.2";
125
- } catch (error) {
126
- console.warn("[MoonUI Pro] External IP detection failed, using fallback:", error);
127
- return "192.168.1.2";
128
- }
129
- }
130
- /**
131
- * Get local IP address using WebRTC (no external service needed)
132
- */
133
- async getWebRTCIP() {
134
- return new Promise((resolve) => {
135
- console.log("[MoonUI Pro] WebRTC IP detection starting...");
136
- try {
137
- const pc = new RTCPeerConnection({
138
- iceServers: [{ urls: "stun:stun.l.google.com:19302" }]
139
- });
140
- pc.createDataChannel("ip-detection");
141
- let candidateCount = 0;
142
- pc.onicecandidate = (event) => {
143
- candidateCount++;
144
- console.log(`[MoonUI Pro] WebRTC candidate ${candidateCount}:`, event.candidate?.candidate);
145
- if (event.candidate) {
146
- const candidate = event.candidate.candidate;
147
- const ipMatch = candidate.match(/(\d+\.\d+\.\d+\.\d+)/);
148
- if (ipMatch && ipMatch[1]) {
149
- const ip = ipMatch[1];
150
- console.log(`[MoonUI Pro] WebRTC IP found: ${ip}`);
151
- if (!ip.startsWith("127.") && !ip.startsWith("0.") && ip !== "0.0.0.0") {
152
- console.log(`[MoonUI Pro] WebRTC IP accepted: ${ip}`);
153
- pc.close();
154
- resolve(ip);
155
- return;
156
- } else {
157
- console.log(`[MoonUI Pro] WebRTC IP rejected (localhost): ${ip}`);
158
- }
159
- }
160
- }
161
- };
162
- pc.onicecandidateerror = (event) => {
163
- console.error("[MoonUI Pro] WebRTC ICE candidate error:", event);
164
- };
165
- pc.createOffer().then((offer) => {
166
- console.log("[MoonUI Pro] WebRTC offer created successfully");
167
- return pc.setLocalDescription(offer);
168
- }).catch((error) => {
169
- console.error("[MoonUI Pro] WebRTC offer creation failed:", error);
170
- resolve("unknown");
171
- });
172
- setTimeout(() => {
173
- console.log(`[MoonUI Pro] WebRTC timeout after ${candidateCount} candidates`);
174
- pc.close();
175
- resolve("unknown");
176
- }, 5e3);
177
- } catch (error) {
178
- console.error("[MoonUI Pro] WebRTC initialization failed:", error);
179
- resolve("unknown");
180
- }
181
- });
182
- }
183
102
  /**
184
103
  * Generate TRULY secure browser-specific device fingerprint
185
104
  * COMPLETELY INDEPENDENT from environment variables
@@ -190,7 +109,7 @@ var init_cli_token_reader = __esm({
190
109
  async getDeviceFingerprint() {
191
110
  try {
192
111
  const platform2 = this.detectBrowserPlatform();
193
- const hostname = await this.getRealExternalIP();
112
+ const hostname = typeof window !== "undefined" ? window.location.hostname : "unknown";
194
113
  const browserUserHash = await this.generateBrowserSpecificUserHash();
195
114
  const browserMachineId = await this.generateBrowserMachineId();
196
115
  const fingerprint = `browser-${hostname}-${browserUserHash}-${browserMachineId}`;
@@ -2851,150 +2770,6 @@ function createAIProvider(provider, config) {
2851
2770
 
2852
2771
  // src/index.ts
2853
2772
  init_use_subscription();
2854
-
2855
- // src/utils/cache-helper.ts
2856
- var forceRefresh2;
2857
- var clearCache2;
2858
- var cliTokenReader2;
2859
- if (typeof window !== "undefined") {
2860
- Promise.resolve().then(() => (init_use_subscription(), use_subscription_exports)).then((module) => {
2861
- forceRefresh2 = module.forceRefresh;
2862
- clearCache2 = module.clearCache;
2863
- });
2864
- Promise.resolve().then(() => (init_cli_token_reader(), cli_token_reader_exports)).then((module) => {
2865
- cliTokenReader2 = module.cliTokenReader;
2866
- });
2867
- }
2868
- var MoonUICache = {
2869
- /**
2870
- * Clear all MoonUI Pro authentication cache
2871
- */
2872
- clear: () => {
2873
- clearCache2();
2874
- console.log("\u2705 MoonUI Pro cache cleared");
2875
- },
2876
- /**
2877
- * Force refresh authentication (clear cache and revalidate)
2878
- */
2879
- refresh: async () => {
2880
- console.log("\u{1F504} Refreshing MoonUI Pro authentication...");
2881
- await forceRefresh2();
2882
- console.log("\u2705 Authentication refreshed");
2883
- },
2884
- /**
2885
- * Clear cache and force refresh in one step
2886
- */
2887
- clearAndRefresh: async () => {
2888
- console.log("\u{1F9F9} Clearing cache and refreshing...");
2889
- clearCache2();
2890
- await forceRefresh2();
2891
- console.log("\u2705 Cache cleared and authentication refreshed");
2892
- },
2893
- /**
2894
- * Check current cache status
2895
- */
2896
- status: () => {
2897
- const cache2 = localStorage.getItem("moonui_license_cache");
2898
- const token = localStorage.getItem("moonui_auth_token");
2899
- if (!cache2 && !token) {
2900
- console.log("\u274C No authentication cache or token found");
2901
- return null;
2902
- }
2903
- if (cache2) {
2904
- const cacheData = JSON.parse(cache2);
2905
- const now = Date.now();
2906
- const age = now - cacheData.timestamp;
2907
- const ageMinutes = Math.floor(age / 6e4);
2908
- console.log("\u{1F4CA} Cache Status:");
2909
- console.log(` Valid: ${cacheData.valid ? "\u2705" : "\u274C"}`);
2910
- console.log(` Has Lifetime Access: ${cacheData.hasLifetimeAccess ? "\u2705" : "\u274C"}`);
2911
- console.log(` Cache Age: ${ageMinutes} minutes`);
2912
- console.log(` Timestamp: ${new Date(cacheData.timestamp).toLocaleString()}`);
2913
- return cacheData;
2914
- }
2915
- if (token) {
2916
- console.log("\u{1F511} Auth token found but no cache");
2917
- return { token };
2918
- }
2919
- },
2920
- /**
2921
- * Debug info - shows all relevant localStorage keys
2922
- */
2923
- debug: async () => {
2924
- console.log("\u{1F50D} MoonUI Pro Debug Info:");
2925
- console.log("----------------------------");
2926
- const keys2 = [
2927
- "moonui_license_cache",
2928
- "moonui_auth_token",
2929
- "moonui-sidebar-state"
2930
- ];
2931
- keys2.forEach((key) => {
2932
- const value = localStorage.getItem(key);
2933
- if (value) {
2934
- console.log(`\u{1F4E6} ${key}:`);
2935
- try {
2936
- const parsed = JSON.parse(value);
2937
- console.log(parsed);
2938
- } catch {
2939
- console.log(value);
2940
- }
2941
- } else {
2942
- console.log(`\u274C ${key}: Not found`);
2943
- }
2944
- });
2945
- if (cliTokenReader2) {
2946
- console.log("\n\u{1F510} CLI Authentication:");
2947
- console.log("----------------------------");
2948
- try {
2949
- const cliToken = await cliTokenReader2.getCLIToken();
2950
- if (cliToken) {
2951
- console.log("\u2705 CLI token found");
2952
- console.log(` Token: ${cliToken.substring(0, 20)}...`);
2953
- } else {
2954
- console.log("\u274C No CLI token available");
2955
- console.log(' Run "moonui login" to authenticate');
2956
- }
2957
- } catch (error) {
2958
- console.log("\u274C Failed to check CLI token:", error);
2959
- }
2960
- }
2961
- },
2962
- /**
2963
- * Check CLI authentication status
2964
- */
2965
- checkCLIAuth: async () => {
2966
- if (!cliTokenReader2) {
2967
- console.log("\u274C CLI auth check only available in development");
2968
- return false;
2969
- }
2970
- try {
2971
- const token = await cliTokenReader2.getCLIToken();
2972
- if (token) {
2973
- console.log("\u2705 CLI authentication active");
2974
- return true;
2975
- } else {
2976
- console.log("\u274C No CLI authentication found");
2977
- console.log('\u{1F4A1} Run "moonui login" to authenticate');
2978
- return false;
2979
- }
2980
- } catch (error) {
2981
- console.error("\u274C Failed to check CLI auth:", error);
2982
- return false;
2983
- }
2984
- }
2985
- };
2986
- if (typeof window !== "undefined") {
2987
- window.MoonUICache = MoonUICache;
2988
- const urlParams = new URLSearchParams(window.location.search);
2989
- if (urlParams.has("clear-cache")) {
2990
- console.log("\u{1F504} Auto-clearing cache due to URL parameter...");
2991
- MoonUICache.clearAndRefresh().then(() => {
2992
- urlParams.delete("clear-cache");
2993
- const newUrl = window.location.pathname + (urlParams.toString() ? "?" + urlParams.toString() : "");
2994
- window.history.replaceState({}, "", newUrl);
2995
- });
2996
- }
2997
- }
2998
2773
  var CACHE_KEY2 = "moonui_license_cache";
2999
2774
  var CACHE_DURATION = !process.env.VERCEL ? 1 * 60 * 1e3 : 24 * 60 * 60 * 1e3;
3000
2775
  var OFFLINE_GRACE_PERIOD = !process.env.VERCEL ? 5 * 60 * 1e3 : 7 * 24 * 60 * 60 * 1e3;
@@ -3006,16 +2781,51 @@ function SubscriptionProvider({ children }) {
3006
2781
  const [isAuthenticated, setIsAuthenticated] = useState(false);
3007
2782
  const [lastCheckTime, setLastCheckTime] = useState(0);
3008
2783
  const getAuthToken2 = async () => {
3009
- if (typeof window !== "undefined") {
3010
- const browserToken = localStorage.getItem("moonui_auth_token");
3011
- if (browserToken) {
3012
- return browserToken;
2784
+ if (process.env.VERCEL) {
2785
+ return process.env.NEXT_PUBLIC_MOONUI_AUTH_TOKEN || process.env.MOONUI_LICENSE_KEY || null;
2786
+ }
2787
+ {
2788
+ if (typeof window !== "undefined") {
2789
+ const browserToken = localStorage.getItem("moonui_auth_token");
2790
+ if (browserToken) {
2791
+ return browserToken;
2792
+ }
2793
+ const devToken = process.env.NEXT_PUBLIC_MOONUI_DEV_TOKEN;
2794
+ const deviceId = process.env.NEXT_PUBLIC_MOONUI_DEVICE_ID;
2795
+ if (devToken && deviceId) {
2796
+ try {
2797
+ const decoded = JSON.parse(atob(devToken));
2798
+ const jwtToken = decoded.token;
2799
+ const response = await fetch("https://moonui.dev/api/cli/validate-session", {
2800
+ method: "POST",
2801
+ headers: {
2802
+ "Authorization": `Bearer ${jwtToken}`,
2803
+ "Content-Type": "application/json"
2804
+ },
2805
+ body: JSON.stringify({
2806
+ deviceId,
2807
+ browserDeviceId: `browser-${navigator.userAgent.substring(0, 10).replace(/[^a-zA-Z0-9]/g, "")}-${Date.now()}`,
2808
+ timestamp: Date.now(),
2809
+ validationType: "hybrid-strict"
2810
+ })
2811
+ });
2812
+ if (response.ok) {
2813
+ const data = await response.json();
2814
+ if (data.valid && data.plan === "pro_lifetime") {
2815
+ return "cli-authenticated-pro";
2816
+ } else if (data.valid) {
2817
+ return null;
2818
+ }
2819
+ }
2820
+ } catch (error) {
2821
+ {
2822
+ console.debug("[MoonUI Pro Context] CLI auth check via moonui.dev failed:", error);
2823
+ }
2824
+ }
2825
+ }
3013
2826
  }
3014
2827
  }
3015
- const devToken = process.env.NEXT_PUBLIC_MOONUI_DEV_TOKEN;
3016
- const authToken = process.env.NEXT_PUBLIC_MOONUI_AUTH_TOKEN;
3017
- const licenseKey = process.env.MOONUI_LICENSE_KEY;
3018
- return devToken || authToken || licenseKey || null;
2828
+ return process.env.NEXT_PUBLIC_MOONUI_AUTH_TOKEN || process.env.MOONUI_LICENSE_KEY || null;
3019
2829
  };
3020
2830
  const validateLicense2 = async () => {
3021
2831
  const token = await getAuthToken2();
@@ -3042,9 +2852,7 @@ function SubscriptionProvider({ children }) {
3042
2852
  return;
3043
2853
  }
3044
2854
  try {
3045
- const isDevelopment = true;
3046
- const apiUrl = isDevelopment && typeof window !== "undefined" ? `${window.location.origin}/api/cli/validate-session` : "https://moonui.dev/api/auth/validate";
3047
- const response = await fetch(apiUrl, {
2855
+ const response = await fetch("https://moonui.dev/api/auth/validate", {
3048
2856
  headers: {
3049
2857
  "Authorization": `Bearer ${token}`
3050
2858
  }
@@ -3161,6 +2969,150 @@ function useSubscriptionContext() {
3161
2969
  }
3162
2970
  return context;
3163
2971
  }
2972
+
2973
+ // src/utils/cache-helper.ts
2974
+ var forceRefresh2;
2975
+ var clearCache2;
2976
+ var cliTokenReader2;
2977
+ if (typeof window !== "undefined") {
2978
+ Promise.resolve().then(() => (init_use_subscription(), use_subscription_exports)).then((module) => {
2979
+ forceRefresh2 = module.forceRefresh;
2980
+ clearCache2 = module.clearCache;
2981
+ });
2982
+ Promise.resolve().then(() => (init_cli_token_reader(), cli_token_reader_exports)).then((module) => {
2983
+ cliTokenReader2 = module.cliTokenReader;
2984
+ });
2985
+ }
2986
+ var MoonUICache = {
2987
+ /**
2988
+ * Clear all MoonUI Pro authentication cache
2989
+ */
2990
+ clear: () => {
2991
+ clearCache2();
2992
+ console.log("\u2705 MoonUI Pro cache cleared");
2993
+ },
2994
+ /**
2995
+ * Force refresh authentication (clear cache and revalidate)
2996
+ */
2997
+ refresh: async () => {
2998
+ console.log("\u{1F504} Refreshing MoonUI Pro authentication...");
2999
+ await forceRefresh2();
3000
+ console.log("\u2705 Authentication refreshed");
3001
+ },
3002
+ /**
3003
+ * Clear cache and force refresh in one step
3004
+ */
3005
+ clearAndRefresh: async () => {
3006
+ console.log("\u{1F9F9} Clearing cache and refreshing...");
3007
+ clearCache2();
3008
+ await forceRefresh2();
3009
+ console.log("\u2705 Cache cleared and authentication refreshed");
3010
+ },
3011
+ /**
3012
+ * Check current cache status
3013
+ */
3014
+ status: () => {
3015
+ const cache2 = localStorage.getItem("moonui_license_cache");
3016
+ const token = localStorage.getItem("moonui_auth_token");
3017
+ if (!cache2 && !token) {
3018
+ console.log("\u274C No authentication cache or token found");
3019
+ return null;
3020
+ }
3021
+ if (cache2) {
3022
+ const cacheData = JSON.parse(cache2);
3023
+ const now = Date.now();
3024
+ const age = now - cacheData.timestamp;
3025
+ const ageMinutes = Math.floor(age / 6e4);
3026
+ console.log("\u{1F4CA} Cache Status:");
3027
+ console.log(` Valid: ${cacheData.valid ? "\u2705" : "\u274C"}`);
3028
+ console.log(` Has Lifetime Access: ${cacheData.hasLifetimeAccess ? "\u2705" : "\u274C"}`);
3029
+ console.log(` Cache Age: ${ageMinutes} minutes`);
3030
+ console.log(` Timestamp: ${new Date(cacheData.timestamp).toLocaleString()}`);
3031
+ return cacheData;
3032
+ }
3033
+ if (token) {
3034
+ console.log("\u{1F511} Auth token found but no cache");
3035
+ return { token };
3036
+ }
3037
+ },
3038
+ /**
3039
+ * Debug info - shows all relevant localStorage keys
3040
+ */
3041
+ debug: async () => {
3042
+ console.log("\u{1F50D} MoonUI Pro Debug Info:");
3043
+ console.log("----------------------------");
3044
+ const keys2 = [
3045
+ "moonui_license_cache",
3046
+ "moonui_auth_token",
3047
+ "moonui-sidebar-state"
3048
+ ];
3049
+ keys2.forEach((key) => {
3050
+ const value = localStorage.getItem(key);
3051
+ if (value) {
3052
+ console.log(`\u{1F4E6} ${key}:`);
3053
+ try {
3054
+ const parsed = JSON.parse(value);
3055
+ console.log(parsed);
3056
+ } catch {
3057
+ console.log(value);
3058
+ }
3059
+ } else {
3060
+ console.log(`\u274C ${key}: Not found`);
3061
+ }
3062
+ });
3063
+ if (cliTokenReader2) {
3064
+ console.log("\n\u{1F510} CLI Authentication:");
3065
+ console.log("----------------------------");
3066
+ try {
3067
+ const cliToken = await cliTokenReader2.getCLIToken();
3068
+ if (cliToken) {
3069
+ console.log("\u2705 CLI token found");
3070
+ console.log(` Token: ${cliToken.substring(0, 20)}...`);
3071
+ } else {
3072
+ console.log("\u274C No CLI token available");
3073
+ console.log(' Run "moonui login" to authenticate');
3074
+ }
3075
+ } catch (error) {
3076
+ console.log("\u274C Failed to check CLI token:", error);
3077
+ }
3078
+ }
3079
+ },
3080
+ /**
3081
+ * Check CLI authentication status
3082
+ */
3083
+ checkCLIAuth: async () => {
3084
+ if (!cliTokenReader2) {
3085
+ console.log("\u274C CLI auth check only available in development");
3086
+ return false;
3087
+ }
3088
+ try {
3089
+ const token = await cliTokenReader2.getCLIToken();
3090
+ if (token) {
3091
+ console.log("\u2705 CLI authentication active");
3092
+ return true;
3093
+ } else {
3094
+ console.log("\u274C No CLI authentication found");
3095
+ console.log('\u{1F4A1} Run "moonui login" to authenticate');
3096
+ return false;
3097
+ }
3098
+ } catch (error) {
3099
+ console.error("\u274C Failed to check CLI auth:", error);
3100
+ return false;
3101
+ }
3102
+ }
3103
+ };
3104
+ if (typeof window !== "undefined") {
3105
+ window.MoonUICache = MoonUICache;
3106
+ const urlParams = new URLSearchParams(window.location.search);
3107
+ if (urlParams.has("clear-cache")) {
3108
+ console.log("\u{1F504} Auto-clearing cache due to URL parameter...");
3109
+ MoonUICache.clearAndRefresh().then(() => {
3110
+ urlParams.delete("clear-cache");
3111
+ const newUrl = window.location.pathname + (urlParams.toString() ? "?" + urlParams.toString() : "");
3112
+ window.history.replaceState({}, "", newUrl);
3113
+ });
3114
+ }
3115
+ }
3164
3116
  var accordionItemVariants = cva(
3165
3117
  "group relative overflow-visible transition-all duration-300 ease-out",
3166
3118
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.32.44",
3
+ "version": "2.33.1",
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",