@moontra/moonui-pro 2.32.10 → 2.32.11
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.d.ts +6 -2
- package/dist/index.global.js +98 -98
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +171 -21
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -77,6 +77,109 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
77
77
|
mod
|
|
78
78
|
));
|
|
79
79
|
|
|
80
|
+
// src/services/cli-token-reader.ts
|
|
81
|
+
var cli_token_reader_exports = {};
|
|
82
|
+
__export(cli_token_reader_exports, {
|
|
83
|
+
CLITokenReader: () => CLITokenReader,
|
|
84
|
+
cliTokenReader: () => cliTokenReader
|
|
85
|
+
});
|
|
86
|
+
var API_BASE, CLITokenReader, cliTokenReader;
|
|
87
|
+
var init_cli_token_reader = __esm({
|
|
88
|
+
"src/services/cli-token-reader.ts"() {
|
|
89
|
+
API_BASE = "https://moonui.dev";
|
|
90
|
+
CLITokenReader = class {
|
|
91
|
+
constructor() {
|
|
92
|
+
this.cachedToken = null;
|
|
93
|
+
this.lastCheck = 0;
|
|
94
|
+
this.CACHE_DURATION = 5 * 60 * 1e3;
|
|
95
|
+
}
|
|
96
|
+
// 5 minutes
|
|
97
|
+
static getInstance() {
|
|
98
|
+
if (!this.instance) {
|
|
99
|
+
this.instance = new CLITokenReader();
|
|
100
|
+
}
|
|
101
|
+
return this.instance;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Try to get CLI token through various methods
|
|
105
|
+
*/
|
|
106
|
+
async getCLIToken() {
|
|
107
|
+
const now = Date.now();
|
|
108
|
+
if (this.cachedToken && now - this.lastCheck < this.CACHE_DURATION) {
|
|
109
|
+
return this.cachedToken;
|
|
110
|
+
}
|
|
111
|
+
{
|
|
112
|
+
try {
|
|
113
|
+
const response = await fetch("/api/moonui/cli-auth", {
|
|
114
|
+
method: "GET",
|
|
115
|
+
credentials: "same-origin"
|
|
116
|
+
});
|
|
117
|
+
if (response.ok) {
|
|
118
|
+
const data = await response.json();
|
|
119
|
+
if (data.token) {
|
|
120
|
+
console.log("[MoonUI Pro] CLI token retrieved from local API");
|
|
121
|
+
this.cachedToken = data.token;
|
|
122
|
+
this.lastCheck = now;
|
|
123
|
+
return data.token;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} catch (error) {
|
|
127
|
+
console.log("[MoonUI Pro] Local CLI auth API not available");
|
|
128
|
+
}
|
|
129
|
+
if (typeof window !== "undefined" && window.__MOONUI_CLI_TOKEN__) {
|
|
130
|
+
console.log("[MoonUI Pro] CLI token found in window object");
|
|
131
|
+
this.cachedToken = window.__MOONUI_CLI_TOKEN__;
|
|
132
|
+
this.lastCheck = now;
|
|
133
|
+
return this.cachedToken;
|
|
134
|
+
}
|
|
135
|
+
if (typeof window !== "undefined") {
|
|
136
|
+
const devToken = localStorage.getItem("moonui_dev_cli_token");
|
|
137
|
+
if (devToken) {
|
|
138
|
+
console.log("[MoonUI Pro] CLI token found in localStorage (dev)");
|
|
139
|
+
this.cachedToken = devToken;
|
|
140
|
+
this.lastCheck = now;
|
|
141
|
+
return devToken;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Validate CLI token with the API
|
|
149
|
+
*/
|
|
150
|
+
async validateCLIToken(token) {
|
|
151
|
+
try {
|
|
152
|
+
const response = await fetch(`${API_BASE}/api/auth/validate`, {
|
|
153
|
+
method: "GET",
|
|
154
|
+
headers: {
|
|
155
|
+
"Authorization": `Bearer ${token}`
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
if (response.ok) {
|
|
159
|
+
const data = await response.json();
|
|
160
|
+
return data.valid === true;
|
|
161
|
+
}
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error("[MoonUI Pro] Failed to validate CLI token:", error);
|
|
164
|
+
}
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Clear cached token
|
|
169
|
+
*/
|
|
170
|
+
clearCache() {
|
|
171
|
+
this.cachedToken = null;
|
|
172
|
+
this.lastCheck = 0;
|
|
173
|
+
if (typeof window !== "undefined") {
|
|
174
|
+
localStorage.removeItem("moonui_dev_cli_token");
|
|
175
|
+
delete window.__MOONUI_CLI_TOKEN__;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
cliTokenReader = CLITokenReader.getInstance();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
80
183
|
// src/hooks/use-subscription.ts
|
|
81
184
|
var use_subscription_exports = {};
|
|
82
185
|
__export(use_subscription_exports, {
|
|
@@ -99,21 +202,23 @@ async function getAuthToken() {
|
|
|
99
202
|
isProduction,
|
|
100
203
|
hasWindow: typeof window !== "undefined"
|
|
101
204
|
});
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
console.log("[MoonUI Pro Auth]
|
|
106
|
-
return
|
|
107
|
-
}
|
|
108
|
-
console.log("[MoonUI Pro Auth] No token
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
205
|
+
{
|
|
206
|
+
const cliToken = await cliTokenReader.getCLIToken();
|
|
207
|
+
if (cliToken) {
|
|
208
|
+
console.log("[MoonUI Pro Auth] Using CLI token");
|
|
209
|
+
return cliToken;
|
|
210
|
+
}
|
|
211
|
+
console.log("[MoonUI Pro Auth] No CLI token available");
|
|
212
|
+
if (typeof window !== "undefined") {
|
|
213
|
+
const browserToken = localStorage.getItem("moonui_auth_token");
|
|
214
|
+
if (browserToken) {
|
|
215
|
+
console.log("[MoonUI Pro Auth] Found token in localStorage (dev fallback)");
|
|
216
|
+
return browserToken;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
console.log("[MoonUI Pro Auth] No valid token found in development - CLI login required");
|
|
220
|
+
return null;
|
|
221
|
+
}
|
|
117
222
|
}
|
|
118
223
|
async function validateLicense() {
|
|
119
224
|
const token = await getAuthToken();
|
|
@@ -257,6 +362,7 @@ function clearCache() {
|
|
|
257
362
|
localStorage.removeItem("moonui_auth_token");
|
|
258
363
|
console.log("[MoonUI Pro] Auth cache cleared");
|
|
259
364
|
}
|
|
365
|
+
cliTokenReader.clearCache();
|
|
260
366
|
}
|
|
261
367
|
function useSubscription() {
|
|
262
368
|
const [, forceUpdate] = useState({});
|
|
@@ -315,6 +421,7 @@ function useSubscription() {
|
|
|
315
421
|
var globalAuthState, isInitialized, subscribers, CACHE_KEY, CACHE_DURATION, OFFLINE_GRACE_PERIOD;
|
|
316
422
|
var init_use_subscription = __esm({
|
|
317
423
|
"src/hooks/use-subscription.ts"() {
|
|
424
|
+
init_cli_token_reader();
|
|
318
425
|
globalAuthState = {
|
|
319
426
|
isLoading: true,
|
|
320
427
|
hasProAccess: false,
|
|
@@ -2322,11 +2429,15 @@ init_use_subscription();
|
|
|
2322
2429
|
// src/utils/cache-helper.ts
|
|
2323
2430
|
var forceRefresh2;
|
|
2324
2431
|
var clearCache2;
|
|
2432
|
+
var cliTokenReader2;
|
|
2325
2433
|
if (typeof window !== "undefined") {
|
|
2326
2434
|
Promise.resolve().then(() => (init_use_subscription(), use_subscription_exports)).then((module) => {
|
|
2327
2435
|
forceRefresh2 = module.forceRefresh;
|
|
2328
2436
|
clearCache2 = module.clearCache;
|
|
2329
2437
|
});
|
|
2438
|
+
Promise.resolve().then(() => (init_cli_token_reader(), cli_token_reader_exports)).then((module) => {
|
|
2439
|
+
cliTokenReader2 = module.cliTokenReader;
|
|
2440
|
+
});
|
|
2330
2441
|
}
|
|
2331
2442
|
var MoonUICache = {
|
|
2332
2443
|
/**
|
|
@@ -2383,7 +2494,7 @@ var MoonUICache = {
|
|
|
2383
2494
|
/**
|
|
2384
2495
|
* Debug info - shows all relevant localStorage keys
|
|
2385
2496
|
*/
|
|
2386
|
-
debug: () => {
|
|
2497
|
+
debug: async () => {
|
|
2387
2498
|
console.log("\u{1F50D} MoonUI Pro Debug Info:");
|
|
2388
2499
|
console.log("----------------------------");
|
|
2389
2500
|
const keys2 = [
|
|
@@ -2405,6 +2516,45 @@ var MoonUICache = {
|
|
|
2405
2516
|
console.log(`\u274C ${key}: Not found`);
|
|
2406
2517
|
}
|
|
2407
2518
|
});
|
|
2519
|
+
if (cliTokenReader2) {
|
|
2520
|
+
console.log("\n\u{1F510} CLI Authentication:");
|
|
2521
|
+
console.log("----------------------------");
|
|
2522
|
+
try {
|
|
2523
|
+
const cliToken = await cliTokenReader2.getCLIToken();
|
|
2524
|
+
if (cliToken) {
|
|
2525
|
+
console.log("\u2705 CLI token found");
|
|
2526
|
+
console.log(` Token: ${cliToken.substring(0, 20)}...`);
|
|
2527
|
+
} else {
|
|
2528
|
+
console.log("\u274C No CLI token available");
|
|
2529
|
+
console.log(' Run "moonui login" to authenticate');
|
|
2530
|
+
}
|
|
2531
|
+
} catch (error) {
|
|
2532
|
+
console.log("\u274C Failed to check CLI token:", error);
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
},
|
|
2536
|
+
/**
|
|
2537
|
+
* Check CLI authentication status
|
|
2538
|
+
*/
|
|
2539
|
+
checkCLIAuth: async () => {
|
|
2540
|
+
if (!cliTokenReader2) {
|
|
2541
|
+
console.log("\u274C CLI auth check only available in development");
|
|
2542
|
+
return false;
|
|
2543
|
+
}
|
|
2544
|
+
try {
|
|
2545
|
+
const token = await cliTokenReader2.getCLIToken();
|
|
2546
|
+
if (token) {
|
|
2547
|
+
console.log("\u2705 CLI authentication active");
|
|
2548
|
+
return true;
|
|
2549
|
+
} else {
|
|
2550
|
+
console.log("\u274C No CLI authentication found");
|
|
2551
|
+
console.log('\u{1F4A1} Run "moonui login" to authenticate');
|
|
2552
|
+
return false;
|
|
2553
|
+
}
|
|
2554
|
+
} catch (error) {
|
|
2555
|
+
console.error("\u274C Failed to check CLI auth:", error);
|
|
2556
|
+
return false;
|
|
2557
|
+
}
|
|
2408
2558
|
}
|
|
2409
2559
|
};
|
|
2410
2560
|
if (typeof window !== "undefined") {
|
|
@@ -68176,7 +68326,7 @@ var LANGUAGE_COLORS = {
|
|
|
68176
68326
|
Objective_C: "#438eff"
|
|
68177
68327
|
// Add more as needed
|
|
68178
68328
|
};
|
|
68179
|
-
var
|
|
68329
|
+
var API_BASE2 = "https://api.github.com";
|
|
68180
68330
|
async function githubFetch(url, token) {
|
|
68181
68331
|
const headers = {
|
|
68182
68332
|
Accept: "application/vnd.github.v3+json"
|
|
@@ -68201,7 +68351,7 @@ async function getRateLimitInfo(token) {
|
|
|
68201
68351
|
if (cached && cached.expiresAt > Date.now()) {
|
|
68202
68352
|
return cached.data;
|
|
68203
68353
|
}
|
|
68204
|
-
const response = await githubFetch(`${
|
|
68354
|
+
const response = await githubFetch(`${API_BASE2}/rate_limit`, token);
|
|
68205
68355
|
const data = await response.json();
|
|
68206
68356
|
const rateLimitInfo = {
|
|
68207
68357
|
limit: data.rate.limit,
|
|
@@ -68228,7 +68378,7 @@ async function fetchUserRepositories(username, token, options) {
|
|
|
68228
68378
|
if (cached && cached.expiresAt > Date.now()) {
|
|
68229
68379
|
return cached.data;
|
|
68230
68380
|
}
|
|
68231
|
-
const response = await githubFetch(`${
|
|
68381
|
+
const response = await githubFetch(`${API_BASE2}/users/${username}/repos?${params}`, token);
|
|
68232
68382
|
const repos = await response.json();
|
|
68233
68383
|
cache.set(cacheKey, {
|
|
68234
68384
|
data: repos,
|
|
@@ -68244,7 +68394,7 @@ async function fetchRepository(owner, repo, token) {
|
|
|
68244
68394
|
if (cached && cached.expiresAt > Date.now()) {
|
|
68245
68395
|
return cached.data;
|
|
68246
68396
|
}
|
|
68247
|
-
const response = await githubFetch(`${
|
|
68397
|
+
const response = await githubFetch(`${API_BASE2}/repos/${owner}/${repo}`, token);
|
|
68248
68398
|
const repository = await response.json();
|
|
68249
68399
|
cache.set(cacheKey, {
|
|
68250
68400
|
data: repository,
|
|
@@ -68262,7 +68412,7 @@ async function fetchContributorsCount(owner, repo, token) {
|
|
|
68262
68412
|
}
|
|
68263
68413
|
try {
|
|
68264
68414
|
const response = await githubFetch(
|
|
68265
|
-
`${
|
|
68415
|
+
`${API_BASE2}/repos/${owner}/${repo}/contributors?per_page=1&anon=true`,
|
|
68266
68416
|
token
|
|
68267
68417
|
);
|
|
68268
68418
|
const linkHeader = response.headers.get("Link");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.32.
|
|
3
|
+
"version": "2.32.11",
|
|
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",
|