@moontra/moonui-pro 2.32.10 → 2.32.12
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 +156 -21
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -77,6 +77,94 @@ 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
|
+
// 5 minutes
|
|
96
|
+
this.apiCheckAttempted = false;
|
|
97
|
+
}
|
|
98
|
+
static getInstance() {
|
|
99
|
+
if (!this.instance) {
|
|
100
|
+
this.instance = new CLITokenReader();
|
|
101
|
+
}
|
|
102
|
+
return this.instance;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Try to get CLI token through various methods
|
|
106
|
+
*/
|
|
107
|
+
async getCLIToken() {
|
|
108
|
+
const now = Date.now();
|
|
109
|
+
if (this.cachedToken && now - this.lastCheck < this.CACHE_DURATION) {
|
|
110
|
+
return this.cachedToken;
|
|
111
|
+
}
|
|
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;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
console.log("[MoonUI Pro] No CLI token available. See documentation for setup instructions.");
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Validate CLI token with the API
|
|
134
|
+
*/
|
|
135
|
+
async validateCLIToken(token) {
|
|
136
|
+
try {
|
|
137
|
+
const response = await fetch(`${API_BASE}/api/auth/validate`, {
|
|
138
|
+
method: "GET",
|
|
139
|
+
headers: {
|
|
140
|
+
"Authorization": `Bearer ${token}`
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
if (response.ok) {
|
|
144
|
+
const data = await response.json();
|
|
145
|
+
return data.valid === true;
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
console.error("[MoonUI Pro] Failed to validate CLI token:", error);
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Clear cached token
|
|
154
|
+
*/
|
|
155
|
+
clearCache() {
|
|
156
|
+
this.cachedToken = null;
|
|
157
|
+
this.lastCheck = 0;
|
|
158
|
+
if (typeof window !== "undefined") {
|
|
159
|
+
localStorage.removeItem("moonui_dev_cli_token");
|
|
160
|
+
delete window.__MOONUI_CLI_TOKEN__;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
cliTokenReader = CLITokenReader.getInstance();
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
80
168
|
// src/hooks/use-subscription.ts
|
|
81
169
|
var use_subscription_exports = {};
|
|
82
170
|
__export(use_subscription_exports, {
|
|
@@ -99,21 +187,23 @@ async function getAuthToken() {
|
|
|
99
187
|
isProduction,
|
|
100
188
|
hasWindow: typeof window !== "undefined"
|
|
101
189
|
});
|
|
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
|
-
|
|
190
|
+
{
|
|
191
|
+
const cliToken = await cliTokenReader.getCLIToken();
|
|
192
|
+
if (cliToken) {
|
|
193
|
+
console.log("[MoonUI Pro Auth] Using CLI token");
|
|
194
|
+
return cliToken;
|
|
195
|
+
}
|
|
196
|
+
console.log("[MoonUI Pro Auth] No CLI token available");
|
|
197
|
+
if (typeof window !== "undefined") {
|
|
198
|
+
const browserToken = localStorage.getItem("moonui_auth_token");
|
|
199
|
+
if (browserToken) {
|
|
200
|
+
console.log("[MoonUI Pro Auth] Found token in localStorage (dev fallback)");
|
|
201
|
+
return browserToken;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
console.log("[MoonUI Pro Auth] No valid token found in development - CLI login required");
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
117
207
|
}
|
|
118
208
|
async function validateLicense() {
|
|
119
209
|
const token = await getAuthToken();
|
|
@@ -257,6 +347,7 @@ function clearCache() {
|
|
|
257
347
|
localStorage.removeItem("moonui_auth_token");
|
|
258
348
|
console.log("[MoonUI Pro] Auth cache cleared");
|
|
259
349
|
}
|
|
350
|
+
cliTokenReader.clearCache();
|
|
260
351
|
}
|
|
261
352
|
function useSubscription() {
|
|
262
353
|
const [, forceUpdate] = useState({});
|
|
@@ -315,6 +406,7 @@ function useSubscription() {
|
|
|
315
406
|
var globalAuthState, isInitialized, subscribers, CACHE_KEY, CACHE_DURATION, OFFLINE_GRACE_PERIOD;
|
|
316
407
|
var init_use_subscription = __esm({
|
|
317
408
|
"src/hooks/use-subscription.ts"() {
|
|
409
|
+
init_cli_token_reader();
|
|
318
410
|
globalAuthState = {
|
|
319
411
|
isLoading: true,
|
|
320
412
|
hasProAccess: false,
|
|
@@ -2322,11 +2414,15 @@ init_use_subscription();
|
|
|
2322
2414
|
// src/utils/cache-helper.ts
|
|
2323
2415
|
var forceRefresh2;
|
|
2324
2416
|
var clearCache2;
|
|
2417
|
+
var cliTokenReader2;
|
|
2325
2418
|
if (typeof window !== "undefined") {
|
|
2326
2419
|
Promise.resolve().then(() => (init_use_subscription(), use_subscription_exports)).then((module) => {
|
|
2327
2420
|
forceRefresh2 = module.forceRefresh;
|
|
2328
2421
|
clearCache2 = module.clearCache;
|
|
2329
2422
|
});
|
|
2423
|
+
Promise.resolve().then(() => (init_cli_token_reader(), cli_token_reader_exports)).then((module) => {
|
|
2424
|
+
cliTokenReader2 = module.cliTokenReader;
|
|
2425
|
+
});
|
|
2330
2426
|
}
|
|
2331
2427
|
var MoonUICache = {
|
|
2332
2428
|
/**
|
|
@@ -2383,7 +2479,7 @@ var MoonUICache = {
|
|
|
2383
2479
|
/**
|
|
2384
2480
|
* Debug info - shows all relevant localStorage keys
|
|
2385
2481
|
*/
|
|
2386
|
-
debug: () => {
|
|
2482
|
+
debug: async () => {
|
|
2387
2483
|
console.log("\u{1F50D} MoonUI Pro Debug Info:");
|
|
2388
2484
|
console.log("----------------------------");
|
|
2389
2485
|
const keys2 = [
|
|
@@ -2405,6 +2501,45 @@ var MoonUICache = {
|
|
|
2405
2501
|
console.log(`\u274C ${key}: Not found`);
|
|
2406
2502
|
}
|
|
2407
2503
|
});
|
|
2504
|
+
if (cliTokenReader2) {
|
|
2505
|
+
console.log("\n\u{1F510} CLI Authentication:");
|
|
2506
|
+
console.log("----------------------------");
|
|
2507
|
+
try {
|
|
2508
|
+
const cliToken = await cliTokenReader2.getCLIToken();
|
|
2509
|
+
if (cliToken) {
|
|
2510
|
+
console.log("\u2705 CLI token found");
|
|
2511
|
+
console.log(` Token: ${cliToken.substring(0, 20)}...`);
|
|
2512
|
+
} else {
|
|
2513
|
+
console.log("\u274C No CLI token available");
|
|
2514
|
+
console.log(' Run "moonui login" to authenticate');
|
|
2515
|
+
}
|
|
2516
|
+
} catch (error) {
|
|
2517
|
+
console.log("\u274C Failed to check CLI token:", error);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
},
|
|
2521
|
+
/**
|
|
2522
|
+
* Check CLI authentication status
|
|
2523
|
+
*/
|
|
2524
|
+
checkCLIAuth: async () => {
|
|
2525
|
+
if (!cliTokenReader2) {
|
|
2526
|
+
console.log("\u274C CLI auth check only available in development");
|
|
2527
|
+
return false;
|
|
2528
|
+
}
|
|
2529
|
+
try {
|
|
2530
|
+
const token = await cliTokenReader2.getCLIToken();
|
|
2531
|
+
if (token) {
|
|
2532
|
+
console.log("\u2705 CLI authentication active");
|
|
2533
|
+
return true;
|
|
2534
|
+
} else {
|
|
2535
|
+
console.log("\u274C No CLI authentication found");
|
|
2536
|
+
console.log('\u{1F4A1} Run "moonui login" to authenticate');
|
|
2537
|
+
return false;
|
|
2538
|
+
}
|
|
2539
|
+
} catch (error) {
|
|
2540
|
+
console.error("\u274C Failed to check CLI auth:", error);
|
|
2541
|
+
return false;
|
|
2542
|
+
}
|
|
2408
2543
|
}
|
|
2409
2544
|
};
|
|
2410
2545
|
if (typeof window !== "undefined") {
|
|
@@ -68176,7 +68311,7 @@ var LANGUAGE_COLORS = {
|
|
|
68176
68311
|
Objective_C: "#438eff"
|
|
68177
68312
|
// Add more as needed
|
|
68178
68313
|
};
|
|
68179
|
-
var
|
|
68314
|
+
var API_BASE2 = "https://api.github.com";
|
|
68180
68315
|
async function githubFetch(url, token) {
|
|
68181
68316
|
const headers = {
|
|
68182
68317
|
Accept: "application/vnd.github.v3+json"
|
|
@@ -68201,7 +68336,7 @@ async function getRateLimitInfo(token) {
|
|
|
68201
68336
|
if (cached && cached.expiresAt > Date.now()) {
|
|
68202
68337
|
return cached.data;
|
|
68203
68338
|
}
|
|
68204
|
-
const response = await githubFetch(`${
|
|
68339
|
+
const response = await githubFetch(`${API_BASE2}/rate_limit`, token);
|
|
68205
68340
|
const data = await response.json();
|
|
68206
68341
|
const rateLimitInfo = {
|
|
68207
68342
|
limit: data.rate.limit,
|
|
@@ -68228,7 +68363,7 @@ async function fetchUserRepositories(username, token, options) {
|
|
|
68228
68363
|
if (cached && cached.expiresAt > Date.now()) {
|
|
68229
68364
|
return cached.data;
|
|
68230
68365
|
}
|
|
68231
|
-
const response = await githubFetch(`${
|
|
68366
|
+
const response = await githubFetch(`${API_BASE2}/users/${username}/repos?${params}`, token);
|
|
68232
68367
|
const repos = await response.json();
|
|
68233
68368
|
cache.set(cacheKey, {
|
|
68234
68369
|
data: repos,
|
|
@@ -68244,7 +68379,7 @@ async function fetchRepository(owner, repo, token) {
|
|
|
68244
68379
|
if (cached && cached.expiresAt > Date.now()) {
|
|
68245
68380
|
return cached.data;
|
|
68246
68381
|
}
|
|
68247
|
-
const response = await githubFetch(`${
|
|
68382
|
+
const response = await githubFetch(`${API_BASE2}/repos/${owner}/${repo}`, token);
|
|
68248
68383
|
const repository = await response.json();
|
|
68249
68384
|
cache.set(cacheKey, {
|
|
68250
68385
|
data: repository,
|
|
@@ -68262,7 +68397,7 @@ async function fetchContributorsCount(owner, repo, token) {
|
|
|
68262
68397
|
}
|
|
68263
68398
|
try {
|
|
68264
68399
|
const response = await githubFetch(
|
|
68265
|
-
`${
|
|
68400
|
+
`${API_BASE2}/repos/${owner}/${repo}/contributors?per_page=1&anon=true`,
|
|
68266
68401
|
token
|
|
68267
68402
|
);
|
|
68268
68403
|
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.12",
|
|
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",
|