@moontra/moonui-pro 3.0.0 → 3.1.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/cdn/index.global.js +121 -121
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +47 -23
- package/dist/server.d.ts +26 -1
- package/dist/server.mjs +74 -5
- package/package.json +2 -1
- package/scripts/postinstall.cjs +199 -0
- package/dist/lib/build-time-validator.d.ts +0 -30
- package/dist/lib/build-time-validator.mjs +0 -117
- package/dist/lib/client-token-verifier.d.ts +0 -27
- package/dist/lib/client-token-verifier.mjs +0 -44
- package/plugin/next.js +0 -83
- package/plugin/vite.js +0 -76
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @moontra/moonui-pro v2.0.9
|
|
3
|
-
* Premium UI components for MoonUI
|
|
4
|
-
* (c) 2025 MoonUI. All rights reserved.
|
|
5
|
-
* @license Commercial - https://moonui.dev/license
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// src/lib/client-token-verifier.ts
|
|
9
|
-
function verifyBuildToken() {
|
|
10
|
-
try {
|
|
11
|
-
const token = process.env.MOONUI_BUILD_TOKEN;
|
|
12
|
-
if (!token) {
|
|
13
|
-
console.log("[MoonUI] No build token found");
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
const decoded = JSON.parse(Buffer.from(token, "base64").toString());
|
|
17
|
-
const payload = {
|
|
18
|
-
licenseKey: decoded.licenseKey || "validated",
|
|
19
|
-
domain: decoded.domain || window.location.hostname,
|
|
20
|
-
timestamp: decoded.timestamp || Date.now(),
|
|
21
|
-
expiresAt: decoded.expiresAt || Date.now() + 7 * 24 * 60 * 60 * 1e3,
|
|
22
|
-
hasProAccess: decoded.hasProAccess !== false,
|
|
23
|
-
plan: decoded.plan || "pro"
|
|
24
|
-
};
|
|
25
|
-
if (payload.expiresAt < Date.now()) {
|
|
26
|
-
console.warn("[MoonUI] Build token expired, rebuild required");
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
return payload;
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error("[MoonUI] Error verifying build token:", error);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function hasProAccess() {
|
|
36
|
-
const token = verifyBuildToken();
|
|
37
|
-
return token ? token.hasProAccess : false;
|
|
38
|
-
}
|
|
39
|
-
function getSubscriptionPlan() {
|
|
40
|
-
const token = verifyBuildToken();
|
|
41
|
-
return token ? token.plan : "free";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { getSubscriptionPlan, hasProAccess, verifyBuildToken };
|
package/plugin/next.js
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MoonUI Pro Next.js Plugin
|
|
3
|
-
* Automatically validates license at build time and injects token
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { validateLicenseAtBuildTime, generateWebpackDefineConfig } = require('../dist/build-time-validator');
|
|
7
|
-
const webpack = require('webpack');
|
|
8
|
-
|
|
9
|
-
// Cache the token to avoid multiple validations
|
|
10
|
-
let cachedToken = null;
|
|
11
|
-
let isValidating = false;
|
|
12
|
-
|
|
13
|
-
module.exports = function withMoonUI(nextConfig = {}) {
|
|
14
|
-
return {
|
|
15
|
-
...nextConfig,
|
|
16
|
-
webpack: (config, options) => {
|
|
17
|
-
// Only run in production builds
|
|
18
|
-
if (!options.dev && !isValidating) {
|
|
19
|
-
isValidating = true;
|
|
20
|
-
|
|
21
|
-
// Get license key from environment
|
|
22
|
-
const licenseKey = process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY ||
|
|
23
|
-
process.env.MOONUI_LICENSE_KEY ||
|
|
24
|
-
process.env.MOONUI_PRO_LICENSE;
|
|
25
|
-
|
|
26
|
-
if (licenseKey) {
|
|
27
|
-
console.log('[MoonUI] Starting build-time license validation...');
|
|
28
|
-
|
|
29
|
-
// Validate license and generate token
|
|
30
|
-
const tokenPromise = validateLicenseAtBuildTime(licenseKey)
|
|
31
|
-
.then(token => {
|
|
32
|
-
if (token) {
|
|
33
|
-
cachedToken = token;
|
|
34
|
-
console.log('[MoonUI] License validated successfully, token generated');
|
|
35
|
-
|
|
36
|
-
// Add DefinePlugin to inject token
|
|
37
|
-
const defineConfig = generateWebpackDefineConfig(token);
|
|
38
|
-
config.plugins.push(
|
|
39
|
-
new webpack.DefinePlugin(defineConfig)
|
|
40
|
-
);
|
|
41
|
-
} else {
|
|
42
|
-
console.warn('[MoonUI] License validation failed, Pro features disabled');
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
.catch(error => {
|
|
46
|
-
console.error('[MoonUI] Error during license validation:', error);
|
|
47
|
-
})
|
|
48
|
-
.finally(() => {
|
|
49
|
-
isValidating = false;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// Make build wait for validation
|
|
53
|
-
if (options.isServer) {
|
|
54
|
-
config.plugins.push({
|
|
55
|
-
apply: (compiler) => {
|
|
56
|
-
compiler.hooks.beforeCompile.tapPromise('MoonUILicensePlugin', async () => {
|
|
57
|
-
await tokenPromise;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
} else {
|
|
63
|
-
console.log('[MoonUI] No license key found, Pro features disabled');
|
|
64
|
-
console.log('[MoonUI] Set NEXT_PUBLIC_MOONUI_LICENSE_KEY to enable Pro features');
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Call user's webpack config if exists
|
|
69
|
-
if (typeof nextConfig.webpack === 'function') {
|
|
70
|
-
return nextConfig.webpack(config, options);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return config;
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
// Preserve other Next.js configurations
|
|
77
|
-
env: {
|
|
78
|
-
...nextConfig.env,
|
|
79
|
-
// Add build info
|
|
80
|
-
MOONUI_BUILD_VERSION: require('../package.json').version,
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
};
|
package/plugin/vite.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MoonUI Pro Vite Plugin
|
|
3
|
-
* Automatically validates license at build time and injects token
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const { validateLicenseAtBuildTime } = require('../dist/build-time-validator');
|
|
7
|
-
|
|
8
|
-
let cachedToken = null;
|
|
9
|
-
|
|
10
|
-
module.exports = function moonuiVitePlugin() {
|
|
11
|
-
return {
|
|
12
|
-
name: 'moonui-license-validator',
|
|
13
|
-
|
|
14
|
-
async config(config, { command }) {
|
|
15
|
-
// Only run in production builds
|
|
16
|
-
if (command === 'build') {
|
|
17
|
-
// Get license key from environment
|
|
18
|
-
const licenseKey = process.env.VITE_MOONUI_LICENSE_KEY ||
|
|
19
|
-
process.env.MOONUI_LICENSE_KEY ||
|
|
20
|
-
process.env.MOONUI_PRO_LICENSE;
|
|
21
|
-
|
|
22
|
-
if (licenseKey) {
|
|
23
|
-
console.log('[MoonUI] Starting build-time license validation...');
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
// Validate license and generate token
|
|
27
|
-
const token = await validateLicenseAtBuildTime(licenseKey);
|
|
28
|
-
|
|
29
|
-
if (token) {
|
|
30
|
-
cachedToken = token;
|
|
31
|
-
console.log('[MoonUI] License validated successfully, token generated');
|
|
32
|
-
|
|
33
|
-
// Add token to define config
|
|
34
|
-
return {
|
|
35
|
-
define: {
|
|
36
|
-
...config.define,
|
|
37
|
-
'process.env.MOONUI_BUILD_TOKEN': JSON.stringify(token),
|
|
38
|
-
'process.env.MOONUI_BUILD_TIME': JSON.stringify(Date.now()),
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
} else {
|
|
42
|
-
console.warn('[MoonUI] License validation failed, Pro features disabled');
|
|
43
|
-
}
|
|
44
|
-
} catch (error) {
|
|
45
|
-
console.error('[MoonUI] Error during license validation:', error);
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
console.log('[MoonUI] No license key found, Pro features disabled');
|
|
49
|
-
console.log('[MoonUI] Set VITE_MOONUI_LICENSE_KEY to enable Pro features');
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return {};
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// Transform hook to inject token for development
|
|
57
|
-
transform(code, id) {
|
|
58
|
-
if (id.includes('moonui-pro') && cachedToken) {
|
|
59
|
-
// Inject token into moonui-pro modules during development
|
|
60
|
-
return {
|
|
61
|
-
code: `
|
|
62
|
-
if (!process.env.MOONUI_BUILD_TOKEN) {
|
|
63
|
-
process.env.MOONUI_BUILD_TOKEN = ${JSON.stringify(cachedToken)};
|
|
64
|
-
}
|
|
65
|
-
${code}
|
|
66
|
-
`,
|
|
67
|
-
map: null
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// ES module export for Vite
|
|
76
|
-
module.exports.default = module.exports;
|