@moontra/moonui-pro 2.32.13 → 2.32.15

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
@@ -90,11 +90,11 @@ var init_cli_token_reader = __esm({
90
90
  CLITokenReader = class {
91
91
  constructor() {
92
92
  this.cachedToken = null;
93
+ this.cachedAuthInfo = null;
93
94
  this.lastCheck = 0;
94
- this.CACHE_DURATION = 5 * 60 * 1e3;
95
- // 5 minutes
96
- this.apiCheckAttempted = false;
95
+ this.CACHE_DURATION = 30 * 1e3;
97
96
  }
97
+ // 30 seconds
98
98
  static getInstance() {
99
99
  if (!this.instance) {
100
100
  this.instance = new CLITokenReader();
@@ -102,7 +102,7 @@ var init_cli_token_reader = __esm({
102
102
  return this.instance;
103
103
  }
104
104
  /**
105
- * Try to get CLI token through various methods
105
+ * Try to get CLI token through API endpoint
106
106
  */
107
107
  async getCLIToken() {
108
108
  const now = Date.now();
@@ -110,22 +110,21 @@ var init_cli_token_reader = __esm({
110
110
  return this.cachedToken;
111
111
  }
112
112
  {
113
- if (typeof window !== "undefined" && window.__MOONUI_CLI_TOKEN__) {
114
- console.log("[MoonUI Pro] CLI token found in window object");
115
- this.cachedToken = window.__MOONUI_CLI_TOKEN__;
116
- this.lastCheck = now;
117
- return this.cachedToken;
118
- }
119
- if (typeof window !== "undefined") {
120
- const devToken = localStorage.getItem("moonui_dev_cli_token");
121
- if (devToken) {
122
- console.log("[MoonUI Pro] CLI token found in localStorage (dev)");
123
- this.cachedToken = devToken;
124
- this.lastCheck = now;
125
- return devToken;
113
+ try {
114
+ const response = await fetch("/api/moonui/cli-auth");
115
+ if (response.ok) {
116
+ const data = await response.json();
117
+ if (data.token) {
118
+ console.log("[MoonUI Pro] CLI authentication detected");
119
+ this.cachedToken = data.token;
120
+ this.cachedAuthInfo = data;
121
+ this.lastCheck = now;
122
+ return data.token;
123
+ }
126
124
  }
125
+ } catch (error) {
126
+ console.log("[MoonUI Pro] CLI authentication API not available");
127
127
  }
128
- console.log("[MoonUI Pro] No CLI token available. See documentation for setup instructions.");
129
128
  }
130
129
  return null;
131
130
  }
@@ -154,11 +153,14 @@ var init_cli_token_reader = __esm({
154
153
  */
155
154
  clearCache() {
156
155
  this.cachedToken = null;
156
+ this.cachedAuthInfo = null;
157
157
  this.lastCheck = 0;
158
- if (typeof window !== "undefined") {
159
- localStorage.removeItem("moonui_dev_cli_token");
160
- delete window.__MOONUI_CLI_TOKEN__;
161
- }
158
+ }
159
+ /**
160
+ * Get cached auth info (if available)
161
+ */
162
+ getCachedAuthInfo() {
163
+ return this.cachedAuthInfo;
162
164
  }
163
165
  };
164
166
  cliTokenReader = CLITokenReader.getInstance();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "2.32.13",
3
+ "version": "2.32.15",
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",