@nice2dev/licensing 1.0.10
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/README.md +123 -0
- package/dist/FeatureGate-Cs1zphXs.cjs +1405 -0
- package/dist/FeatureGate-Cs1zphXs.cjs.map +1 -0
- package/dist/FeatureGate-Da7fCJA5.js +1406 -0
- package/dist/FeatureGate-Da7fCJA5.js.map +1 -0
- package/dist/__vite-browser-external-2Ng8QIWW.js +5 -0
- package/dist/__vite-browser-external-2Ng8QIWW.js.map +1 -0
- package/dist/__vite-browser-external-DES75WN9.cjs +5 -0
- package/dist/__vite-browser-external-DES75WN9.cjs.map +1 -0
- package/dist/index.cjs +4352 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2285 -0
- package/dist/index.mjs +4353 -0
- package/dist/index.mjs.map +1 -0
- package/dist/react.cjs +1039 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.ts +327 -0
- package/dist/react.mjs +1039 -0
- package/dist/react.mjs.map +1 -0
- package/package.json +83 -0
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @nice2dev/licensing
|
|
2
|
+
|
|
3
|
+
Enterprise Licensing System for Nice2Dev UI components.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **License Key Generation** — RSA-signed keys with checksum validation
|
|
8
|
+
- **Hardware Fingerprinting** — Machine binding for license protection
|
|
9
|
+
- **Online/Offline Validation** — Works with or without internet
|
|
10
|
+
- **Seat Management** — Track concurrent users
|
|
11
|
+
- **Floating Licenses** — Shared license pools
|
|
12
|
+
- **Feature Gating** — Tier-based and feature-based access control
|
|
13
|
+
- **React Components** — Ready-to-use UI components
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @nice2dev/licensing
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
### Basic Validation
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { validateLicense, isFeatureLicensed } from '@nice2dev/licensing';
|
|
27
|
+
|
|
28
|
+
// Validate a license key
|
|
29
|
+
const result = await validateLicense('XXXX-XXXX-XXXX-XXXX-XXXX');
|
|
30
|
+
if (result.valid) {
|
|
31
|
+
console.log('License tier:', result.license.tier);
|
|
32
|
+
console.log('Days remaining:', result.daysRemaining);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Check feature access
|
|
36
|
+
const hasAdvanced = await isFeatureLicensed(key, 'advanced-components');
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### React Integration
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { LicenseProvider, FeatureGate, LicenseStatus, LicenseActivator } from '@nice2dev/licensing/react';
|
|
43
|
+
|
|
44
|
+
function App() {
|
|
45
|
+
return (
|
|
46
|
+
<LicenseProvider serverUrl="https://your-license-server.com">
|
|
47
|
+
<LicenseStatus detailed />
|
|
48
|
+
|
|
49
|
+
<FeatureGate feature="advanced-components" showUpgradePrompt>
|
|
50
|
+
<AdvancedDataGrid />
|
|
51
|
+
</FeatureGate>
|
|
52
|
+
|
|
53
|
+
<LicenseActivator onActivated={(license) => console.log('Activated:', license)} />
|
|
54
|
+
</LicenseProvider>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Generate License Keys (Server-side)
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { generateLicenseInfo } from '@nice2dev/licensing';
|
|
63
|
+
|
|
64
|
+
const license = generateLicenseInfo({
|
|
65
|
+
tier: 'team',
|
|
66
|
+
licensee: 'Acme Corp',
|
|
67
|
+
email: 'admin@acme.com',
|
|
68
|
+
durationDays: 365,
|
|
69
|
+
maxSeats: 10,
|
|
70
|
+
features: ['advanced-components', 'collaboration'],
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
console.log('License key:', license.key);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## License Tiers
|
|
77
|
+
|
|
78
|
+
| Tier | Seats | Machines | Features |
|
|
79
|
+
| ---------- | ----- | -------- | -------------------------------- |
|
|
80
|
+
| Trial | 1 | 1 | Core + watermark |
|
|
81
|
+
| Personal | 1 | 2 | + Advanced, Theming, i18n |
|
|
82
|
+
| Team | 10 | 20 | + Collaboration, Analytics |
|
|
83
|
+
| Enterprise | 50 | 100 | + White-label, SSO, API |
|
|
84
|
+
| Site | ∞ | 1000 | + Source code, Dedicated support |
|
|
85
|
+
| OEM | ∞ | ∞ | + Redistribution rights |
|
|
86
|
+
|
|
87
|
+
## Components
|
|
88
|
+
|
|
89
|
+
### LicenseProvider
|
|
90
|
+
|
|
91
|
+
Context provider for license state management.
|
|
92
|
+
|
|
93
|
+
### FeatureGate
|
|
94
|
+
|
|
95
|
+
Conditionally render content based on license features.
|
|
96
|
+
|
|
97
|
+
### LicenseStatus
|
|
98
|
+
|
|
99
|
+
Display current license status badge.
|
|
100
|
+
|
|
101
|
+
### LicenseActivator
|
|
102
|
+
|
|
103
|
+
License key input form.
|
|
104
|
+
|
|
105
|
+
### UpgradePrompt
|
|
106
|
+
|
|
107
|
+
Upgrade call-to-action component.
|
|
108
|
+
|
|
109
|
+
### LicenseComparison
|
|
110
|
+
|
|
111
|
+
Plan comparison table.
|
|
112
|
+
|
|
113
|
+
### TrialWatermark
|
|
114
|
+
|
|
115
|
+
Watermark overlay for trial versions.
|
|
116
|
+
|
|
117
|
+
## API Reference
|
|
118
|
+
|
|
119
|
+
See full documentation at [docs.nice2dev.com/licensing](https://docs.nice2dev.com/licensing)
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT © NiceToDev
|