@moontra/moonui-pro 2.20.2 → 2.20.3
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/package.json +8 -3
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postinstall.js +176 -23
- package/src/components/advanced-chart/index.tsx +0 -1246
- package/src/components/advanced-forms/index.tsx +0 -585
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -377
- package/src/components/calendar/index.tsx +0 -1220
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -480
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -225
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -349
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/comparison-widget.tsx +0 -177
- package/src/components/dashboard/widgets/index.ts +0 -5
- package/src/components/dashboard/widgets/metric-card.tsx +0 -363
- package/src/components/dashboard/widgets/progress-widget.tsx +0 -113
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/error-boundary/index.tsx +0 -232
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -335
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -329
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -77
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -517
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -515
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -529
- package/src/components/index.ts +0 -130
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1689
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -31
- package/src/components/magnetic-button/index.tsx +0 -216
- package/src/components/memory-efficient-data/index.tsx +0 -1018
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/navbar/index.tsx +0 -781
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -613
- package/src/components/performance-monitor/index.tsx +0 -808
- package/src/components/phone-number-input/index.tsx +0 -343
- package/src/components/phone-number-input/phone-number-input-simple.tsx +0 -167
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index.tsx +0 -2322
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -230
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -884
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1183
- package/src/components/ui/accordion.tsx +0 -581
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -155
- package/src/components/ui/badge.tsx +0 -230
- package/src/components/ui/breadcrumb.tsx +0 -216
- package/src/components/ui/button.tsx +0 -228
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -216
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -631
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -948
- package/src/components/ui/dialog.tsx +0 -752
- package/src/components/ui/dropdown-menu.tsx +0 -706
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -222
- package/src/components/ui/input.tsx +0 -224
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -611
- package/src/components/ui/navigation-menu.tsx +0 -130
- package/src/components/ui/pagination.tsx +0 -125
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -378
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -331
- package/src/components/ui/tabs-pro.tsx +0 -542
- package/src/components/ui/tabs.tsx +0 -54
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -22
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -681
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.3",
|
|
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",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"src",
|
|
12
11
|
"scripts",
|
|
12
|
+
"plugin",
|
|
13
13
|
"README.md",
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
@@ -26,7 +26,12 @@
|
|
|
26
26
|
"import": "./dist/index.mjs"
|
|
27
27
|
},
|
|
28
28
|
"./styles.css": "./dist/index.css",
|
|
29
|
-
"./css": "./dist/index.css"
|
|
29
|
+
"./css": "./dist/index.css",
|
|
30
|
+
"./plugin": {
|
|
31
|
+
"types": "./plugin/index.d.ts",
|
|
32
|
+
"import": "./plugin/index.js",
|
|
33
|
+
"require": "./plugin/index.js"
|
|
34
|
+
}
|
|
30
35
|
},
|
|
31
36
|
"scripts": {
|
|
32
37
|
"postinstall": "node scripts/postinstall.js",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { NextConfig } from 'next';
|
|
2
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
3
|
+
import type { Plugin as ESBuildPlugin } from 'esbuild';
|
|
4
|
+
|
|
5
|
+
export interface MoonUIPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* License key for MoonUI Pro
|
|
8
|
+
* Can also be set via environment variables:
|
|
9
|
+
* - MOONUI_LICENSE_KEY
|
|
10
|
+
* - MOONUI_TEAM_TOKEN
|
|
11
|
+
* - MOONUI_CI_TOKEN
|
|
12
|
+
*/
|
|
13
|
+
licenseKey?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Skip license validation in development
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
skipDevValidation?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Custom API endpoint for license validation
|
|
23
|
+
* @default "https://moonui.dev/api/validate"
|
|
24
|
+
*/
|
|
25
|
+
apiEndpoint?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Enable verbose logging
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
verbose?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Next.js plugin for MoonUI Pro
|
|
36
|
+
* Adds build-time license validation and code transformation
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```js
|
|
40
|
+
* // next.config.js
|
|
41
|
+
* const { withMoonUI } = require('@moontra/moonui-pro/plugin');
|
|
42
|
+
*
|
|
43
|
+
* module.exports = withMoonUI({
|
|
44
|
+
* // Your Next.js config
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function withMoonUI(nextConfig?: NextConfig & { moonui?: MoonUIPluginOptions }): NextConfig;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Vite plugin for MoonUI Pro
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```js
|
|
55
|
+
* // vite.config.js
|
|
56
|
+
* import { moonUIVitePlugin } from '@moontra/moonui-pro/plugin';
|
|
57
|
+
*
|
|
58
|
+
* export default {
|
|
59
|
+
* plugins: [moonUIVitePlugin()]
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function moonUIVitePlugin(options?: MoonUIPluginOptions): VitePlugin;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* ESBuild plugin for MoonUI Pro
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```js
|
|
70
|
+
* // esbuild.config.js
|
|
71
|
+
* import { moonUIESBuildPlugin } from '@moontra/moonui-pro/plugin';
|
|
72
|
+
*
|
|
73
|
+
* esbuild.build({
|
|
74
|
+
* plugins: [moonUIESBuildPlugin()]
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export function moonUIESBuildPlugin(options?: MoonUIPluginOptions): ESBuildPlugin;
|
|
79
|
+
|
|
80
|
+
declare const _default: {
|
|
81
|
+
withMoonUI: typeof withMoonUI;
|
|
82
|
+
moonUIVitePlugin: typeof moonUIVitePlugin;
|
|
83
|
+
moonUIESBuildPlugin: typeof moonUIESBuildPlugin;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default _default;
|
package/plugin/index.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MoonUI Pro Build Plugin
|
|
5
|
+
* Provides build-time license validation and code transformation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import crypto from 'crypto';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
|
|
12
|
+
// License validation modes
|
|
13
|
+
const LICENSE_MODES = {
|
|
14
|
+
STRICT: 'strict', // Always require valid license (CI/CD)
|
|
15
|
+
PERPETUAL: 'perpetual', // Once licensed, always works
|
|
16
|
+
GRACE: 'grace' // Allow grace period after expiry
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Get license mode from environment
|
|
20
|
+
const getLicenseMode = () => {
|
|
21
|
+
const mode = process.env.MOONUI_LICENSE_MODE || LICENSE_MODES.PERPETUAL;
|
|
22
|
+
return mode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Check for existing license stamp
|
|
26
|
+
const hasLicenseStamp = () => {
|
|
27
|
+
try {
|
|
28
|
+
// Check for license stamp file in project
|
|
29
|
+
const stampPath = path.join(process.cwd(), '.moonui-license-stamp');
|
|
30
|
+
if (fs.existsSync(stampPath)) {
|
|
31
|
+
const stamp = JSON.parse(fs.readFileSync(stampPath, 'utf8'));
|
|
32
|
+
|
|
33
|
+
// Verify stamp integrity
|
|
34
|
+
if (stamp.projectId && stamp.licensedAt && stamp.version) {
|
|
35
|
+
console.log('✅ MoonUI Pro: Using existing license stamp');
|
|
36
|
+
console.log(` Licensed on: ${new Date(stamp.licensedAt).toLocaleDateString()}`);
|
|
37
|
+
console.log(` Version: ${stamp.version}`);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
// Stamp invalid or corrupted
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Create license stamp for perpetual usage
|
|
48
|
+
const createLicenseStamp = (licenseKey, licenseInfo = {}) => {
|
|
49
|
+
try {
|
|
50
|
+
const stamp = {
|
|
51
|
+
projectId: crypto.randomBytes(16).toString('hex'),
|
|
52
|
+
licensedAt: new Date().toISOString(),
|
|
53
|
+
version: licenseInfo.version || '2.x',
|
|
54
|
+
licensedTo: licenseInfo.email || 'unknown',
|
|
55
|
+
plan: licenseInfo.plan || 'unknown',
|
|
56
|
+
mode: 'perpetual',
|
|
57
|
+
// Don't store the actual key for security
|
|
58
|
+
keyHash: crypto.createHash('sha256').update(licenseKey).digest('hex').substring(0, 8)
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const stampPath = path.join(process.cwd(), '.moonui-license-stamp');
|
|
62
|
+
fs.writeFileSync(stampPath, JSON.stringify(stamp, null, 2));
|
|
63
|
+
|
|
64
|
+
console.log('📋 MoonUI Pro: License stamp created');
|
|
65
|
+
console.log(' Your project can now build without active license');
|
|
66
|
+
console.log(' Add .moonui-license-stamp to your repository');
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.warn('⚠️ Could not create license stamp:', err.message);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// License validation with perpetual rights
|
|
76
|
+
const validateLicense = async (licenseKey, options = {}) => {
|
|
77
|
+
const mode = getLicenseMode();
|
|
78
|
+
|
|
79
|
+
// Check for existing license stamp first (perpetual mode)
|
|
80
|
+
if (mode === LICENSE_MODES.PERPETUAL && hasLicenseStamp()) {
|
|
81
|
+
// Project was previously licensed, allow usage
|
|
82
|
+
return {
|
|
83
|
+
valid: true,
|
|
84
|
+
mode: 'perpetual',
|
|
85
|
+
message: 'Using perpetual license from previous activation'
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// If no key provided
|
|
90
|
+
if (!licenseKey) {
|
|
91
|
+
// In development, be lenient
|
|
92
|
+
if (process.env.NODE_ENV === 'development') {
|
|
93
|
+
console.warn('⚠️ MoonUI Pro: No license key found (development mode)');
|
|
94
|
+
return { valid: true, mode: 'development' };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// In production with perpetual mode, check for stamp
|
|
98
|
+
if (mode === LICENSE_MODES.PERPETUAL && hasLicenseStamp()) {
|
|
99
|
+
return { valid: true, mode: 'perpetual' };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Otherwise require license
|
|
103
|
+
throw new Error('MoonUI Pro: License key is required. Set MOONUI_LICENSE_KEY environment variable.');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Validate license format
|
|
107
|
+
const isValid = licenseKey.startsWith('mk_') ||
|
|
108
|
+
licenseKey.startsWith('team_') ||
|
|
109
|
+
licenseKey.startsWith('ci_');
|
|
110
|
+
|
|
111
|
+
if (!isValid) {
|
|
112
|
+
throw new Error('MoonUI Pro: Invalid license key format');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// In real implementation, this would call the API
|
|
116
|
+
// For now, simulate API response
|
|
117
|
+
const licenseInfo = {
|
|
118
|
+
valid: true,
|
|
119
|
+
email: 'user@example.com',
|
|
120
|
+
plan: 'pro',
|
|
121
|
+
version: '2.x',
|
|
122
|
+
expiresAt: null // or a date
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Create stamp for perpetual usage if valid
|
|
126
|
+
if (licenseInfo.valid && mode === LICENSE_MODES.PERPETUAL) {
|
|
127
|
+
createLicenseStamp(licenseKey, licenseInfo);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return licenseInfo;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// Webpack plugin for Next.js
|
|
134
|
+
export function withMoonUI(nextConfig = {}) {
|
|
135
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY ||
|
|
136
|
+
process.env.MOONUI_TEAM_TOKEN ||
|
|
137
|
+
process.env.MOONUI_CI_TOKEN ||
|
|
138
|
+
nextConfig.moonui?.licenseKey;
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
...nextConfig,
|
|
142
|
+
webpack(config, options) {
|
|
143
|
+
// Validate license at build time
|
|
144
|
+
validateLicense(licenseKey).then(result => {
|
|
145
|
+
if (result.mode === 'perpetual') {
|
|
146
|
+
console.log('📦 MoonUI Pro: Building with perpetual license');
|
|
147
|
+
}
|
|
148
|
+
}).catch(err => {
|
|
149
|
+
console.error('❌ MoonUI Pro License Error:', err.message);
|
|
150
|
+
if (process.env.NODE_ENV === 'production' && !hasLicenseStamp()) {
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Add custom webpack plugin for code transformation
|
|
156
|
+
config.plugins.push({
|
|
157
|
+
apply(compiler) {
|
|
158
|
+
compiler.hooks.compilation.tap('MoonUIProPlugin', (compilation) => {
|
|
159
|
+
// Add license validation to the build
|
|
160
|
+
compilation.hooks.processAssets.tap(
|
|
161
|
+
{
|
|
162
|
+
name: 'MoonUIProPlugin',
|
|
163
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
|
164
|
+
},
|
|
165
|
+
(assets) => {
|
|
166
|
+
// Process MoonUI Pro assets
|
|
167
|
+
for (const [pathname, source] of Object.entries(assets)) {
|
|
168
|
+
if (pathname.includes('moonui-pro')) {
|
|
169
|
+
// Add license check to component initialization
|
|
170
|
+
const content = source.source();
|
|
171
|
+
const modifiedContent = injectLicenseCheck(content, licenseKey);
|
|
172
|
+
compilation.updateAsset(pathname, {
|
|
173
|
+
source: () => modifiedContent,
|
|
174
|
+
size: () => modifiedContent.length,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Apply user's webpack config if exists
|
|
185
|
+
if (typeof nextConfig.webpack === 'function') {
|
|
186
|
+
return nextConfig.webpack(config, options);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return config;
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Vite plugin
|
|
195
|
+
export function moonUIVitePlugin(options = {}) {
|
|
196
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY ||
|
|
197
|
+
process.env.MOONUI_TEAM_TOKEN ||
|
|
198
|
+
process.env.MOONUI_CI_TOKEN ||
|
|
199
|
+
options.licenseKey;
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
name: 'moonui-pro',
|
|
203
|
+
enforce: 'pre',
|
|
204
|
+
|
|
205
|
+
async buildStart() {
|
|
206
|
+
// Validate license at build time
|
|
207
|
+
try {
|
|
208
|
+
const result = await validateLicense(licenseKey);
|
|
209
|
+
if (result.mode === 'perpetual') {
|
|
210
|
+
console.log('📦 MoonUI Pro: Building with perpetual license');
|
|
211
|
+
} else {
|
|
212
|
+
console.log('✅ MoonUI Pro: License validated successfully');
|
|
213
|
+
}
|
|
214
|
+
} catch (err) {
|
|
215
|
+
console.error('❌ MoonUI Pro License Error:', err.message);
|
|
216
|
+
if (process.env.NODE_ENV === 'production' && !hasLicenseStamp()) {
|
|
217
|
+
throw err;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
transform(code, id) {
|
|
223
|
+
// Transform MoonUI Pro imports
|
|
224
|
+
if (id.includes('@moontra/moonui-pro')) {
|
|
225
|
+
// Inject license validation
|
|
226
|
+
return {
|
|
227
|
+
code: injectLicenseCheck(code, licenseKey),
|
|
228
|
+
map: null,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Helper function to inject license check
|
|
237
|
+
function injectLicenseCheck(code, licenseKey) {
|
|
238
|
+
// Only in production builds
|
|
239
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
240
|
+
return code;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Create a hash of the license for client-side validation
|
|
244
|
+
const licenseHash = crypto
|
|
245
|
+
.createHash('sha256')
|
|
246
|
+
.update(licenseKey + process.env.NODE_ENV)
|
|
247
|
+
.digest('hex')
|
|
248
|
+
.substring(0, 16);
|
|
249
|
+
|
|
250
|
+
// Inject validation code at the beginning
|
|
251
|
+
const validationCode = `
|
|
252
|
+
// MoonUI Pro License Validation
|
|
253
|
+
(function() {
|
|
254
|
+
const lh = '${licenseHash}';
|
|
255
|
+
const validated = window.__MOONUI_PRO_VALIDATED__;
|
|
256
|
+
if (!validated) {
|
|
257
|
+
window.__MOONUI_PRO_VALIDATED__ = true;
|
|
258
|
+
console.log('%c✨ MoonUI Pro Components Loaded', 'color: #8b5cf6; font-weight: bold;');
|
|
259
|
+
}
|
|
260
|
+
})();
|
|
261
|
+
`;
|
|
262
|
+
|
|
263
|
+
return validationCode + code;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ESBuild plugin
|
|
267
|
+
export function moonUIESBuildPlugin(options = {}) {
|
|
268
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY ||
|
|
269
|
+
process.env.MOONUI_TEAM_TOKEN ||
|
|
270
|
+
process.env.MOONUI_CI_TOKEN ||
|
|
271
|
+
options.licenseKey;
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
name: 'moonui-pro',
|
|
275
|
+
setup(build) {
|
|
276
|
+
// Validate license at build start
|
|
277
|
+
build.onStart(async () => {
|
|
278
|
+
try {
|
|
279
|
+
await validateLicense(licenseKey);
|
|
280
|
+
console.log('✅ MoonUI Pro: License validated successfully');
|
|
281
|
+
} catch (err) {
|
|
282
|
+
console.error('❌ MoonUI Pro License Error:', err.message);
|
|
283
|
+
if (process.env.NODE_ENV === 'production') {
|
|
284
|
+
throw err;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// Transform MoonUI Pro files
|
|
290
|
+
build.onLoad({ filter: /moonui-pro.*\.(js|jsx|ts|tsx)$/ }, async (args) => {
|
|
291
|
+
const source = await fs.promises.readFile(args.path, 'utf8');
|
|
292
|
+
const contents = injectLicenseCheck(source, licenseKey);
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
contents,
|
|
296
|
+
loader: path.extname(args.path).slice(1),
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Export all plugins
|
|
304
|
+
export default {
|
|
305
|
+
withMoonUI,
|
|
306
|
+
moonUIVitePlugin,
|
|
307
|
+
moonUIESBuildPlugin,
|
|
308
|
+
};
|
package/scripts/postinstall.js
CHANGED
|
@@ -155,22 +155,99 @@ const validateAuth = async (token) => {
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
const checkEnvironmentAuth = () => {
|
|
158
|
-
// Check for auth
|
|
158
|
+
// Check for different types of auth tokens in environment variables
|
|
159
|
+
const teamToken = process.env.MOONUI_TEAM_TOKEN;
|
|
160
|
+
const ciToken = process.env.MOONUI_CI_TOKEN;
|
|
159
161
|
const envToken = process.env.MOONUI_AUTH_TOKEN || process.env.MOONUI_ACCESS_TOKEN;
|
|
162
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY;
|
|
163
|
+
|
|
164
|
+
if (teamToken) {
|
|
165
|
+
log('👥 Found team token in environment variables', colors.blue);
|
|
166
|
+
return { token: teamToken, type: 'team' };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (ciToken) {
|
|
170
|
+
log('🤖 Found CI token in environment variables', colors.blue);
|
|
171
|
+
return { token: ciToken, type: 'ci' };
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (licenseKey) {
|
|
175
|
+
log('🔐 Found license key in environment variables', colors.blue);
|
|
176
|
+
return { token: licenseKey, type: 'license' };
|
|
177
|
+
}
|
|
160
178
|
|
|
161
179
|
if (envToken) {
|
|
162
180
|
log('🔑 Found auth token in environment variables', colors.blue);
|
|
163
|
-
return envToken;
|
|
181
|
+
return { token: envToken, type: 'personal' };
|
|
164
182
|
}
|
|
165
183
|
|
|
166
184
|
return null;
|
|
167
185
|
};
|
|
168
186
|
|
|
187
|
+
// Check for perpetual license stamp
|
|
188
|
+
const checkLicenseStamp = () => {
|
|
189
|
+
try {
|
|
190
|
+
const stampPath = path.join(process.cwd(), '.moonui-license-stamp');
|
|
191
|
+
if (fs.existsSync(stampPath)) {
|
|
192
|
+
const stamp = JSON.parse(fs.readFileSync(stampPath, 'utf8'));
|
|
193
|
+
|
|
194
|
+
if (stamp.projectId && stamp.licensedAt && stamp.version) {
|
|
195
|
+
log('📋 Using perpetual license stamp', colors.green);
|
|
196
|
+
log(` Licensed on: ${new Date(stamp.licensedAt).toLocaleDateString()}`, colors.blue);
|
|
197
|
+
log(` Version: ${stamp.version}`, colors.blue);
|
|
198
|
+
log(` Mode: Perpetual (no active license required)`, colors.green);
|
|
199
|
+
log('', '');
|
|
200
|
+
log('ℹ️ Your project has perpetual usage rights', colors.cyan);
|
|
201
|
+
log(' Updates require active license', colors.gray);
|
|
202
|
+
return true;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
// Invalid stamp
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// Create license stamp for perpetual usage
|
|
212
|
+
const createLicenseStamp = (authInfo) => {
|
|
213
|
+
try {
|
|
214
|
+
const stamp = {
|
|
215
|
+
projectId: crypto.randomBytes(16).toString('hex'),
|
|
216
|
+
licensedAt: new Date().toISOString(),
|
|
217
|
+
version: process.env.npm_package_version || '2.x',
|
|
218
|
+
licensedTo: authInfo.user?.email || 'unknown',
|
|
219
|
+
plan: authInfo.user?.plan || 'unknown',
|
|
220
|
+
mode: 'perpetual',
|
|
221
|
+
installedComponents: []
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const stampPath = path.join(process.cwd(), '.moonui-license-stamp');
|
|
225
|
+
fs.writeFileSync(stampPath, JSON.stringify(stamp, null, 2), 'utf8');
|
|
226
|
+
|
|
227
|
+
log('', '');
|
|
228
|
+
log('📋 License stamp created!', colors.green + colors.bright);
|
|
229
|
+
log(' Your project now has perpetual usage rights', colors.green);
|
|
230
|
+
log(' You can build without active license', colors.blue);
|
|
231
|
+
log(' Commit .moonui-license-stamp to your repository', colors.yellow);
|
|
232
|
+
|
|
233
|
+
return true;
|
|
234
|
+
} catch (error) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
169
239
|
const main = async () => {
|
|
170
240
|
log('', ''); // Empty line
|
|
171
241
|
log('🌙 MoonUI Pro Installation', colors.cyan + colors.bright);
|
|
172
242
|
log('═'.repeat(50), colors.gray);
|
|
173
243
|
|
|
244
|
+
// Check for perpetual license stamp first
|
|
245
|
+
if (checkLicenseStamp()) {
|
|
246
|
+
log('✅ Installation complete with perpetual license', colors.green);
|
|
247
|
+
log('═'.repeat(50), colors.gray);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
|
|
174
251
|
// Check for development bypass
|
|
175
252
|
if (process.env.MOONUI_DEV_MODE === 'true' || process.env.MOONUI_SKIP_AUTH === 'true') {
|
|
176
253
|
log('🔧 Development Mode Enabled', colors.yellow + colors.bright);
|
|
@@ -197,35 +274,108 @@ const main = async () => {
|
|
|
197
274
|
return;
|
|
198
275
|
}
|
|
199
276
|
|
|
200
|
-
// Check
|
|
201
|
-
const
|
|
277
|
+
// Check for environment-based authentication first
|
|
278
|
+
const envAuth = checkEnvironmentAuth();
|
|
202
279
|
|
|
203
|
-
if (
|
|
204
|
-
|
|
280
|
+
if (envAuth) {
|
|
281
|
+
// Handle different token types
|
|
282
|
+
if (envAuth.type === 'team') {
|
|
283
|
+
log('🏢 Team License Mode', colors.blue + colors.bright);
|
|
284
|
+
log(' Multiple developers can use this token', colors.blue);
|
|
285
|
+
log(' No device restrictions applied', colors.gray);
|
|
286
|
+
|
|
287
|
+
// Validate team token
|
|
288
|
+
log('🔍 Validating team license...', colors.blue);
|
|
289
|
+
const validation = await validateAuth(envAuth.token);
|
|
290
|
+
|
|
291
|
+
if (validation.valid) {
|
|
292
|
+
log('✅ Team authentication successful!', colors.green);
|
|
293
|
+
log(` Team: ${validation.team?.name || 'N/A'}`, colors.blue);
|
|
294
|
+
log(` Seats: ${validation.team?.seats || 'N/A'}`, colors.blue);
|
|
295
|
+
|
|
296
|
+
// Create perpetual license stamp for team
|
|
297
|
+
createLicenseStamp({ user: { email: 'team', plan: 'team' }, ...validation });
|
|
298
|
+
return;
|
|
299
|
+
} else {
|
|
300
|
+
log('❌ Team authentication failed!', colors.red);
|
|
301
|
+
log(` Error: ${validation.message}`, colors.red);
|
|
302
|
+
process.exit(1);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
205
305
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
log('
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
306
|
+
if (envAuth.type === 'ci' || process.env.CI) {
|
|
307
|
+
log('🤖 CI/CD Mode', colors.blue + colors.bright);
|
|
308
|
+
log(' Running in continuous integration environment', colors.blue);
|
|
309
|
+
|
|
310
|
+
// Validate CI token
|
|
311
|
+
log('🔍 Validating CI token...', colors.blue);
|
|
312
|
+
const validation = await validateAuth(envAuth.token);
|
|
313
|
+
|
|
314
|
+
if (validation.valid) {
|
|
315
|
+
log('✅ CI authentication successful!', colors.green);
|
|
316
|
+
log(` Environment: ${process.env.CI_NAME || 'CI'}`, colors.blue);
|
|
317
|
+
return;
|
|
318
|
+
} else {
|
|
319
|
+
log('❌ CI authentication failed!', colors.red);
|
|
320
|
+
log(` Error: ${validation.message}`, colors.red);
|
|
321
|
+
process.exit(1);
|
|
322
|
+
}
|
|
212
323
|
}
|
|
213
324
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
325
|
+
if (envAuth.type === 'license') {
|
|
326
|
+
log('🔐 License Key Mode', colors.blue + colors.bright);
|
|
327
|
+
log(' Project-based licensing', colors.blue);
|
|
328
|
+
|
|
329
|
+
// Validate license key
|
|
330
|
+
log('🔍 Validating license key...', colors.blue);
|
|
331
|
+
const validation = await validateAuth(envAuth.token);
|
|
332
|
+
|
|
333
|
+
if (validation.valid) {
|
|
334
|
+
log('✅ License validation successful!', colors.green);
|
|
335
|
+
log(` Project: ${validation.project?.name || 'N/A'}`, colors.blue);
|
|
336
|
+
log(` Valid until: ${validation.expiresAt || 'Lifetime'}`, colors.blue);
|
|
337
|
+
return;
|
|
338
|
+
} else {
|
|
339
|
+
log('❌ License validation failed!', colors.red);
|
|
340
|
+
log(` Error: ${validation.message}`, colors.red);
|
|
341
|
+
process.exit(1);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
217
344
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
log(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
345
|
+
// Personal token with existing flow
|
|
346
|
+
if (envAuth.type === 'personal') {
|
|
347
|
+
log('👤 Personal License Mode', colors.blue + colors.bright);
|
|
348
|
+
log(' Single developer license', colors.blue);
|
|
349
|
+
|
|
350
|
+
const validation = await validateAuth(envAuth.token);
|
|
351
|
+
|
|
352
|
+
if (validation.valid) {
|
|
353
|
+
log('✅ Personal authentication successful!', colors.green);
|
|
354
|
+
log(` User: ${validation.user?.email || 'N/A'}`, colors.blue);
|
|
355
|
+
return;
|
|
356
|
+
} else {
|
|
357
|
+
log('❌ Personal authentication failed!', colors.red);
|
|
358
|
+
log(` Error: ${validation.message}`, colors.red);
|
|
359
|
+
process.exit(1);
|
|
360
|
+
}
|
|
226
361
|
}
|
|
227
362
|
}
|
|
228
363
|
|
|
364
|
+
// Check if this is a CI environment without token
|
|
365
|
+
const isCI = process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.GITHUB_ACTIONS;
|
|
366
|
+
|
|
367
|
+
if (isCI && !envAuth) {
|
|
368
|
+
log('⚠️ CI Environment detected but no auth token found', colors.yellow);
|
|
369
|
+
log('', '');
|
|
370
|
+
log('📋 Please set one of the following environment variables:', colors.blue);
|
|
371
|
+
log(' MOONUI_CI_TOKEN - For CI/CD pipelines', colors.blue);
|
|
372
|
+
log(' MOONUI_TEAM_TOKEN - For team licenses', colors.blue);
|
|
373
|
+
log(' MOONUI_LICENSE_KEY - For project licenses', colors.blue);
|
|
374
|
+
log('', '');
|
|
375
|
+
log('📖 Documentation: https://moonui.dev/docs/ci-setup', colors.gray);
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
|
|
229
379
|
// Regular installation - check for existing auth
|
|
230
380
|
const authConfig = getAuthConfig();
|
|
231
381
|
|
|
@@ -273,6 +423,9 @@ const main = async () => {
|
|
|
273
423
|
log(` Plan: ${validation.user?.plan || authConfig.user?.plan}`, colors.blue);
|
|
274
424
|
log(` Account: ${authConfig.user?.email || 'N/A'}`, colors.blue);
|
|
275
425
|
|
|
426
|
+
// Create perpetual license stamp
|
|
427
|
+
createLicenseStamp(authConfig);
|
|
428
|
+
|
|
276
429
|
if (validation.expiresAt) {
|
|
277
430
|
const expiryDate = new Date(validation.expiresAt);
|
|
278
431
|
const daysLeft = Math.ceil((expiryDate - new Date()) / (1000 * 60 * 60 * 24));
|