@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.
@@ -0,0 +1,2285 @@
1
+ import { default as default_2 } from 'react';
2
+
3
+ declare interface ActivationError {
4
+ code: string;
5
+ message: string;
6
+ retryable: boolean;
7
+ supportRequired?: boolean;
8
+ }
9
+
10
+ export declare class ActivationService {
11
+ private config;
12
+ constructor(config: ActivationWizardConfig);
13
+ private request;
14
+ validateKey(licenseKey: string): Promise<LicenseValidationResult>;
15
+ checkHardware(licenseKey: string, machineId: string, fingerprint: string): Promise<{
16
+ allowed: boolean;
17
+ reason?: string;
18
+ existingMachines?: number;
19
+ }>;
20
+ activate(licenseKey: string, machineId: string, fingerprint: string, machineName: string): Promise<LicenseInfo>;
21
+ getOfflineChallenge(licenseKey: string, machineId: string): Promise<string>;
22
+ activateOffline(licenseKey: string, machineId: string, response: string): Promise<LicenseInfo>;
23
+ }
24
+
25
+ export declare interface ActivationState {
26
+ step: ActivationStep;
27
+ licenseKey: string;
28
+ validation: LicenseValidationResult | null;
29
+ machineId: string | null;
30
+ fingerprint: string | null;
31
+ machineName: string;
32
+ termsAccepted: boolean;
33
+ error: ActivationError | null;
34
+ activatedLicense: LicenseInfo | null;
35
+ offlineChallenge: string | null;
36
+ }
37
+
38
+ export declare type ActivationStep = 'enter-key' | 'validate' | 'hardware-check' | 'terms' | 'activating' | 'success' | 'error';
39
+
40
+ /** Main Activation Wizard component */
41
+ export declare const ActivationWizard: default_2.FC<ActivationWizardProps>;
42
+
43
+ export declare interface ActivationWizardConfig {
44
+ /** API base URL */
45
+ apiBaseUrl: string;
46
+ /** API authentication token */
47
+ authToken?: string;
48
+ /** Terms of service URL */
49
+ termsUrl?: string;
50
+ /** Privacy policy URL */
51
+ privacyUrl?: string;
52
+ /** Support email */
53
+ supportEmail?: string;
54
+ /** Allow offline activation */
55
+ allowOfflineActivation?: boolean;
56
+ /** Machine name (auto-detected if not provided) */
57
+ machineName?: string;
58
+ /** Callback when activation succeeds */
59
+ onActivationSuccess?: (license: LicenseInfo) => void;
60
+ /** Callback when activation fails */
61
+ onActivationError?: (error: ActivationError) => void;
62
+ /** Callback when wizard is canceled */
63
+ onCancel?: () => void;
64
+ }
65
+
66
+ declare interface ActivationWizardProps extends ActivationWizardConfig {
67
+ className?: string;
68
+ style?: default_2.CSSProperties;
69
+ }
70
+
71
+ export declare interface AnalyticsConfig {
72
+ apiBaseUrl: string;
73
+ authToken?: string;
74
+ /** Organization/customer ID */
75
+ organizationId?: string;
76
+ /** Refresh interval in ms (0 = no auto-refresh) */
77
+ refreshInterval?: number;
78
+ /** Enable real-time updates */
79
+ realtime?: boolean;
80
+ /** Default time range */
81
+ defaultTimeRange?: TimeRange;
82
+ /** Features to track */
83
+ trackedFeatures?: FeatureId[];
84
+ }
85
+
86
+ declare interface AnalyticsState {
87
+ loading: boolean;
88
+ error: string | null;
89
+ timeRange: TimeRange;
90
+ overview: OverviewMetrics | null;
91
+ licenseActivity: TimeSeriesDataPoint[];
92
+ userActivity: TimeSeriesDataPoint[];
93
+ featureUsage: FeatureUsageData[];
94
+ topUsers: UserActivityData[];
95
+ licenseUtilization: LicenseUtilizationData[];
96
+ geoData: GeographicData[];
97
+ trends: TrendData[];
98
+ retentionCohorts: CohortData[];
99
+ }
100
+
101
+ /**
102
+ * Multi-endpoint rate limiter — maintains a separate bucket per endpoint/action.
103
+ */
104
+ export declare class ApiRateLimiter {
105
+ private limiters;
106
+ private tier;
107
+ private config;
108
+ private endpointOverrides;
109
+ constructor(tier: LicenseTier, config?: RateLimitConfig);
110
+ /** Set endpoint-specific rate limit overrides */
111
+ setEndpointOverride(endpoint: string, overrides: Partial<RateLimitConfig>): void;
112
+ /** Update the current tier (resets all limiters) */
113
+ setTier(tier: LicenseTier): void;
114
+ /** Get or create a limiter for an endpoint */
115
+ private getLimiter;
116
+ /** Check if a request to the given endpoint is allowed and consume a token */
117
+ check(endpoint?: string): RateLimitResult;
118
+ /** Peek without consuming */
119
+ peek(endpoint?: string): RateLimitResult;
120
+ /** Reset all limiters */
121
+ reset(): void;
122
+ }
123
+
124
+ /** Actor who triggered an audit event */
125
+ export declare interface AuditActor {
126
+ /** Actor type */
127
+ type: 'user' | 'admin' | 'system' | 'api';
128
+ /** Actor identifier (user ID, service name, etc.) */
129
+ id: string;
130
+ /** Display name */
131
+ name?: string;
132
+ }
133
+
134
+ /** Single audit log entry */
135
+ export declare interface AuditEntry {
136
+ /** Unique entry ID */
137
+ id: string;
138
+ /** Event type */
139
+ event: AuditEventType;
140
+ /** ISO timestamp */
141
+ timestamp: string;
142
+ /** License key (hashed for security) */
143
+ licenseKeyHash: string;
144
+ /** Actor who performed the action */
145
+ actor: AuditActor;
146
+ /** Previous value (for changes) */
147
+ previousValue?: unknown;
148
+ /** New value (for changes) */
149
+ newValue?: unknown;
150
+ /** Human-readable description */
151
+ description: string;
152
+ /** IP address of the action (hashed) */
153
+ ipHash?: string;
154
+ /** Additional metadata */
155
+ metadata?: Record<string, unknown>;
156
+ }
157
+
158
+ /** Audit event types */
159
+ export declare type AuditEventType = 'license.created' | 'license.activated' | 'license.deactivated' | 'license.renewed' | 'license.expired' | 'license.revoked' | 'license.tier-changed' | 'license.seats-changed' | 'license.feature-added' | 'license.feature-removed' | 'license.machine-bound' | 'license.machine-unbound' | 'license.validation-failed' | 'license.grace-started' | 'license.grace-ended' | 'whitelabel.config-changed' | 'sla.breach-detected' | 'admin.key-generated' | 'admin.bulk-action';
160
+
161
+ /** Audit export format */
162
+ export declare type AuditExportFormat = 'json' | 'csv';
163
+
164
+ /** Query filter for audit log */
165
+ export declare interface AuditQuery {
166
+ /** Filter by event types */
167
+ events?: AuditEventType[];
168
+ /** Filter by license key hash */
169
+ licenseKeyHash?: string;
170
+ /** Filter by actor ID */
171
+ actorId?: string;
172
+ /** Start date (inclusive) */
173
+ from?: Date;
174
+ /** End date (inclusive) */
175
+ to?: Date;
176
+ /** Maximum number of results */
177
+ limit?: number;
178
+ /** Offset for pagination */
179
+ offset?: number;
180
+ }
181
+
182
+ /**
183
+ * Audit Trail — append-only log with query and export capabilities
184
+ */
185
+ export declare class AuditTrail {
186
+ private entries;
187
+ private serverUrl?;
188
+ private apiKey?;
189
+ constructor(options?: {
190
+ serverUrl?: string;
191
+ apiKey?: string;
192
+ });
193
+ /** Append an audit entry */
194
+ log(event: AuditEventType, licenseKey: LicenseKey, actor: AuditActor, description: string, details?: {
195
+ previousValue?: unknown;
196
+ newValue?: unknown;
197
+ ipHash?: string;
198
+ metadata?: Record<string, unknown>;
199
+ }): AuditEntry;
200
+ logActivation(licenseKey: LicenseKey, actor: AuditActor): AuditEntry;
201
+ logDeactivation(licenseKey: LicenseKey, actor: AuditActor): AuditEntry;
202
+ logTierChange(licenseKey: LicenseKey, actor: AuditActor, from: LicenseTier, to: LicenseTier): AuditEntry;
203
+ logSeatsChange(licenseKey: LicenseKey, actor: AuditActor, from: number, to: number): AuditEntry;
204
+ logRevocation(licenseKey: LicenseKey, actor: AuditActor, reason?: string): AuditEntry;
205
+ /** Query audit entries with filters */
206
+ query(filter?: AuditQuery): AuditEntry[];
207
+ /** Get total entry count (optionally filtered) */
208
+ count(filter?: AuditQuery): number;
209
+ /** Export audit entries */
210
+ export(filter?: AuditQuery, format?: AuditExportFormat): string;
211
+ private sendToServer;
212
+ /** Get all entries (read-only copy) */
213
+ getAll(): AuditEntry[];
214
+ }
215
+
216
+ export declare interface BillingConfig {
217
+ /** Stripe publishable key */
218
+ stripePublishableKey?: string;
219
+ /** Paddle vendor ID */
220
+ paddleVendorId?: string;
221
+ /** Paddle environment */
222
+ paddleEnvironment?: 'sandbox' | 'production';
223
+ /** API base URL for billing operations */
224
+ apiBaseUrl: string;
225
+ /** Authentication token */
226
+ authToken?: string;
227
+ /** Default currency */
228
+ defaultCurrency?: string;
229
+ /** Supported currencies */
230
+ supportedCurrencies?: string[];
231
+ /** Tax handling */
232
+ taxHandling?: 'inclusive' | 'exclusive';
233
+ /** Webhooks enabled */
234
+ webhooksEnabled?: boolean;
235
+ }
236
+
237
+ declare type BillingInterval = 'monthly' | 'yearly' | 'once';
238
+
239
+ declare interface BillingPortalSession {
240
+ id: string;
241
+ url: string;
242
+ provider: PaymentProvider;
243
+ }
244
+
245
+ export declare class BillingService {
246
+ private config;
247
+ constructor(config: BillingConfig);
248
+ private request;
249
+ /** Get all pricing plans */
250
+ getPlans(currency?: string): Promise<PricingPlan[]>;
251
+ /** Get plan by ID */
252
+ getPlan(planId: string): Promise<PricingPlan>;
253
+ /** Compare plans (for upgrade/downgrade) */
254
+ comparePlans(currentPlanId: string, targetPlanId: string, seats?: number): Promise<{
255
+ currentPlan: PricingPlan;
256
+ targetPlan: PricingPlan;
257
+ proration: ProratedAmount;
258
+ isUpgrade: boolean;
259
+ }>;
260
+ /** Get current subscription */
261
+ getSubscription(): Promise<Subscription | null>;
262
+ /** Get subscription by ID */
263
+ getSubscriptionById(subscriptionId: string): Promise<Subscription>;
264
+ /** Create checkout session for new subscription */
265
+ createCheckoutSession(options: {
266
+ planId: string;
267
+ interval: BillingInterval;
268
+ seats?: number;
269
+ successUrl: string;
270
+ cancelUrl: string;
271
+ provider?: PaymentProvider;
272
+ couponCode?: string;
273
+ metadata?: Record<string, string>;
274
+ }): Promise<CheckoutSession>;
275
+ /** Create billing portal session */
276
+ createPortalSession(returnUrl: string): Promise<BillingPortalSession>;
277
+ /** Update subscription (change plan, seats) */
278
+ updateSubscription(options: {
279
+ planId?: string;
280
+ seats?: number;
281
+ interval?: BillingInterval;
282
+ prorate?: boolean;
283
+ }): Promise<Subscription>;
284
+ /** Cancel subscription */
285
+ cancelSubscription(options?: {
286
+ atPeriodEnd?: boolean;
287
+ reason?: string;
288
+ feedback?: string;
289
+ }): Promise<Subscription>;
290
+ /** Resume canceled subscription */
291
+ resumeSubscription(): Promise<Subscription>;
292
+ /** Pause subscription (Paddle only) */
293
+ pauseSubscription(): Promise<Subscription>;
294
+ /** Get saved payment methods */
295
+ getPaymentMethods(): Promise<PaymentMethod[]>;
296
+ /** Add payment method (redirect to Stripe/Paddle) */
297
+ addPaymentMethod(returnUrl: string): Promise<{
298
+ url: string;
299
+ }>;
300
+ /** Remove payment method */
301
+ removePaymentMethod(paymentMethodId: string): Promise<void>;
302
+ /** Set default payment method */
303
+ setDefaultPaymentMethod(paymentMethodId: string): Promise<void>;
304
+ /** Get invoices */
305
+ getInvoices(options?: {
306
+ limit?: number;
307
+ offset?: number;
308
+ status?: Invoice['status'];
309
+ }): Promise<{
310
+ invoices: Invoice[];
311
+ total: number;
312
+ }>;
313
+ /** Get upcoming invoice preview */
314
+ getUpcomingInvoice(): Promise<Invoice | null>;
315
+ /** Download invoice PDF */
316
+ downloadInvoice(invoiceId: string): Promise<Blob>;
317
+ /** Validate coupon code */
318
+ validateCoupon(code: string, planId?: string): Promise<{
319
+ valid: boolean;
320
+ coupon?: {
321
+ id: string;
322
+ code: string;
323
+ percentOff?: number;
324
+ amountOff?: number;
325
+ duration: 'once' | 'forever' | 'repeating';
326
+ durationInMonths?: number;
327
+ applicablePlans?: string[];
328
+ };
329
+ error?: string;
330
+ }>;
331
+ /** Apply coupon to subscription */
332
+ applyCoupon(code: string): Promise<Subscription>;
333
+ /** Report usage */
334
+ reportUsage(records: UsageRecord[]): Promise<void>;
335
+ /** Get usage summary */
336
+ getUsageSummary(startDate: string, endDate: string): Promise<{
337
+ metrics: {
338
+ id: string;
339
+ name: string;
340
+ usage: number;
341
+ limit?: number;
342
+ cost: number;
343
+ }[];
344
+ totalCost: number;
345
+ }>;
346
+ private detectPreferredProvider;
347
+ /** Format price for display */
348
+ formatPrice(amount: number, currency?: string): string;
349
+ /** Calculate savings for yearly billing */
350
+ calculateYearlySavings(plan: PricingPlan): {
351
+ monthlyTotal: number;
352
+ yearlyTotal: number;
353
+ savings: number;
354
+ savingsPercent: number;
355
+ };
356
+ }
357
+
358
+ export declare interface BuildLicenseConfig {
359
+ /** License key (can be from env var) */
360
+ licenseKey?: LicenseKey;
361
+ /** Environment variable name for license key */
362
+ licenseKeyEnvVar?: string;
363
+ /** License server URL for online validation */
364
+ licenseServerUrl?: string;
365
+ /** Fail build if license is invalid */
366
+ failOnInvalid?: boolean;
367
+ /** Fail build if license is expired */
368
+ failOnExpired?: boolean;
369
+ /** Required tier for build */
370
+ requiredTier?: LicenseTier;
371
+ /** Required features for build */
372
+ requiredFeatures?: FeatureId[];
373
+ /** Allow offline license (cached) */
374
+ allowOffline?: boolean;
375
+ /** Cache directory for offline license */
376
+ cacheDir?: string;
377
+ /** Silent mode (no console output) */
378
+ silent?: boolean;
379
+ /** Custom validation endpoint */
380
+ validationEndpoint?: string;
381
+ /** Timeout for license validation (ms) */
382
+ validationTimeout?: number;
383
+ }
384
+
385
+ export declare interface BuildLicenseResult {
386
+ valid: boolean;
387
+ licenseKey?: LicenseKey;
388
+ tier?: LicenseTier;
389
+ licensee?: string;
390
+ features?: FeatureId[];
391
+ expiresAt?: string;
392
+ daysRemaining?: number;
393
+ warnings: string[];
394
+ errors: string[];
395
+ }
396
+
397
+ export declare class BuildLicenseValidator {
398
+ private config;
399
+ private licenseInfo;
400
+ private validationResult;
401
+ constructor(config?: BuildLicenseConfig);
402
+ /** Get license key from config or environment */
403
+ private getLicenseKey;
404
+ /** Log message (unless silent) */
405
+ private log;
406
+ /** Validate license online */
407
+ private validateOnline;
408
+ /** Load cached license */
409
+ private loadCachedLicense;
410
+ /** Save license to cache */
411
+ private saveLicenseCache;
412
+ /** Validate license (main entry point) */
413
+ validate(): Promise<BuildLicenseResult>;
414
+ /** Get validation result */
415
+ getResult(): BuildLicenseResult | null;
416
+ /** Get license info */
417
+ getLicenseInfo(): LicenseInfo | null;
418
+ /** Check if feature is available */
419
+ hasFeature(featureId: FeatureId): boolean;
420
+ /** Check if tier meets requirement */
421
+ meetsTier(requiredTier: LicenseTier): boolean;
422
+ }
423
+
424
+ /** Bundle tag added to chunks containing protected code */
425
+ export declare interface BundleTag {
426
+ /** Chunk/file identifier */
427
+ chunkId: string;
428
+ /** Required tier */
429
+ requiredTier: LicenseTier;
430
+ /** Access level */
431
+ accessLevel: SourceAccessLevel;
432
+ /** Modules in this chunk */
433
+ modules: string[];
434
+ }
435
+
436
+ /**
437
+ * Check feature access with detailed result
438
+ */
439
+ export declare function checkFeatureAccess(license: LicenseInfo | null, featureId: FeatureId): FeatureCheckResult;
440
+
441
+ export declare interface CheckoutSession {
442
+ id: string;
443
+ url: string;
444
+ provider: PaymentProvider;
445
+ expiresAt: string;
446
+ }
447
+
448
+ export declare interface CILicenseCheckOptions {
449
+ /** License key */
450
+ licenseKey?: LicenseKey;
451
+ /** Environment variable containing license key */
452
+ licenseKeyEnvVar?: string;
453
+ /** License server URL */
454
+ licenseServerUrl?: string;
455
+ /** Required minimum tier */
456
+ requiredTier?: LicenseTier;
457
+ /** Required features */
458
+ requiredFeatures?: FeatureId[];
459
+ /** Fail pipeline if invalid */
460
+ failOnInvalid?: boolean;
461
+ /** Fail pipeline if expired */
462
+ failOnExpired?: boolean;
463
+ /** Skip validation for PRs from forks */
464
+ skipForForks?: boolean;
465
+ /** Grace period days after expiration */
466
+ expirationGraceDays?: number;
467
+ /** Output format */
468
+ outputFormat?: 'human' | 'json' | 'ci-annotations';
469
+ /** Set CI environment variables with license info */
470
+ setEnvVars?: boolean;
471
+ }
472
+
473
+ export declare interface CILicenseCheckResult {
474
+ success: boolean;
475
+ platform: CIPlatform;
476
+ exitCode: number;
477
+ message: string;
478
+ license?: {
479
+ key: LicenseKey;
480
+ tier: LicenseTier;
481
+ licensee?: string;
482
+ features: FeatureId[];
483
+ expiresAt?: string;
484
+ daysRemaining?: number;
485
+ };
486
+ warnings: string[];
487
+ errors: string[];
488
+ }
489
+
490
+ export declare type CIPlatform = 'github-actions' | 'azure-devops' | 'gitlab-ci' | 'jenkins' | 'circleci' | 'bitbucket-pipelines' | 'travis-ci' | 'unknown';
491
+
492
+ declare interface CohortData {
493
+ cohort: string;
494
+ retained: number[];
495
+ total: number;
496
+ }
497
+
498
+ /**
499
+ * Collect all fingerprint components
500
+ */
501
+ export declare function collectFingerprintData(): Promise<HardwareFingerprintData>;
502
+
503
+ /**
504
+ * Compare two fingerprints with tolerance (fuzzy match)
505
+ * Returns similarity score 0-1
506
+ */
507
+ export declare function compareFingerprintsData(fp1: HardwareFingerprintData, fp2: HardwareFingerprintData): number;
508
+
509
+ /**
510
+ * Compare two tiers, returns positive if a > b
511
+ */
512
+ export declare function compareTiers(a: LicenseTier, b: LicenseTier): number;
513
+
514
+ /** Convenience factory */
515
+ export declare function createApiRateLimiter(tier: LicenseTier, config?: RateLimitConfig): ApiRateLimiter;
516
+
517
+ /** Convenience factory */
518
+ export declare function createAuditTrail(options?: {
519
+ serverUrl?: string;
520
+ apiKey?: string;
521
+ }): AuditTrail;
522
+
523
+ export declare function createBillingService(config: BillingConfig): BillingService;
524
+
525
+ /** Create floating license manager instance */
526
+ export declare function createFloatingLicenseManager(serverUrl: string, apiKey?: string): FloatingLicenseManager;
527
+
528
+ export declare function createRefundService(config: RefundConfig): RefundService;
529
+
530
+ /** Create seat manager instance */
531
+ export declare function createSeatManager(serverUrl: string, apiKey?: string): SeatManager;
532
+
533
+ /** Convenience factory */
534
+ export declare function createSlaTracker(tier: LicenseTier): SlaTracker;
535
+
536
+ /** Convenience factory */
537
+ export declare function createTelemetry(config: UsageTelemetryConfig): UsageTelemetry;
538
+
539
+ /** Convenience factory */
540
+ export declare function createWhiteLabelManager(tier: LicenseTier, config?: WhiteLabelConfig): WhiteLabelManager;
541
+
542
+ export declare interface CustomerLicenseOverview {
543
+ /** Total licenses owned */
544
+ totalLicenses: number;
545
+ /** Active licenses */
546
+ activeLicenses: number;
547
+ /** Expired licenses */
548
+ expiredLicenses: number;
549
+ /** Licenses in grace period */
550
+ gracePeriodLicenses: number;
551
+ /** Total seats across all licenses */
552
+ totalSeats: number;
553
+ /** Used seats */
554
+ usedSeats: number;
555
+ /** Available seats */
556
+ availableSeats: number;
557
+ /** Licenses expiring soon (30 days) */
558
+ expiringSoon: LicenseInfo[];
559
+ /** All licenses */
560
+ licenses: LicenseInfo[];
561
+ }
562
+
563
+ /** Default tier rate limits (requests per minute) */
564
+ export declare const DEFAULT_RATE_LIMITS: RateLimitConfig;
565
+
566
+ export declare const DEFAULT_REFUND_POLICY: RefundPolicy;
567
+
568
+ /** Default SLA configurations per tier */
569
+ export declare const DEFAULT_SLA_CONFIGS: Record<LicenseTier, SlaTierConfig>;
570
+
571
+ export declare function detectCIPlatform(): CIPlatform;
572
+
573
+ /**
574
+ * Extract metadata from license key
575
+ */
576
+ export declare function extractKeyMetadata(key: LicenseKey): {
577
+ tier: LicenseTier;
578
+ year: number;
579
+ month: number;
580
+ } | null;
581
+
582
+ /**
583
+ * Feature check result
584
+ */
585
+ export declare interface FeatureCheckResult {
586
+ allowed: boolean;
587
+ reason?: 'no-license' | 'tier-insufficient' | 'feature-not-included' | 'expired';
588
+ requiredTier?: LicenseTier;
589
+ upgradeTarget?: LicenseTier;
590
+ }
591
+
592
+ /** Feature definition */
593
+ export declare interface FeatureDefinition {
594
+ /** Feature ID */
595
+ id: FeatureId;
596
+ /** Display name */
597
+ name: string;
598
+ /** Description */
599
+ description: string;
600
+ /** Required tier (minimum) */
601
+ requiredTier: LicenseTier;
602
+ /** Is beta feature */
603
+ isBeta?: boolean;
604
+ /** Feature category */
605
+ category?: string;
606
+ /** Dependencies on other features */
607
+ dependencies?: FeatureId[];
608
+ }
609
+
610
+ /** Feature flag identifier */
611
+ export declare type FeatureId = string;
612
+
613
+ export declare interface FeatureUsageData {
614
+ featureId: FeatureId;
615
+ featureName: string;
616
+ category?: string;
617
+ totalUses: number;
618
+ uniqueUsers: number;
619
+ avgUsesPerUser: number;
620
+ trend: number;
621
+ history: TimeSeriesDataPoint[];
622
+ }
623
+
624
+ /**
625
+ * Floating License Manager — for shared concurrent licenses
626
+ */
627
+ export declare class FloatingLicenseManager {
628
+ private serverUrl;
629
+ private apiKey?;
630
+ private leaseId?;
631
+ private renewInterval?;
632
+ constructor(serverUrl: string, apiKey?: string);
633
+ /**
634
+ * Acquire a floating license
635
+ */
636
+ acquireLease(licenseKey: LicenseKey): Promise<{
637
+ success: boolean;
638
+ leaseId?: string;
639
+ expiresAt?: string;
640
+ error?: string;
641
+ }>;
642
+ /**
643
+ * Release floating license
644
+ */
645
+ releaseLease(licenseKey: LicenseKey): Promise<boolean>;
646
+ /**
647
+ * Get floating license status
648
+ */
649
+ getFloatingStatus(licenseKey: LicenseKey): Promise<{
650
+ total: number;
651
+ available: number;
652
+ leases: Array<{
653
+ leaseId: string;
654
+ machineId: MachineId;
655
+ expiresAt: string;
656
+ }>;
657
+ }>;
658
+ /**
659
+ * Start lease renewal interval
660
+ */
661
+ private startLeaseRenewal;
662
+ /**
663
+ * Stop lease renewal
664
+ */
665
+ private stopLeaseRenewal;
666
+ /**
667
+ * Check if we have an active lease
668
+ */
669
+ hasActiveLease(): boolean;
670
+ /**
671
+ * Cleanup
672
+ */
673
+ cleanup(licenseKey: LicenseKey): Promise<void>;
674
+ }
675
+
676
+ export declare function generateAzureDevOpsPipeline(options: {
677
+ requiredTier?: LicenseTier;
678
+ }): string;
679
+
680
+ /**
681
+ * Generate bundle tags for a build manifest.
682
+ * Consumed by the Vite/webpack plugin to tag output chunks.
683
+ */
684
+ export declare function generateBundleTags(): BundleTag[];
685
+
686
+ /**
687
+ * Generate hardware fingerprint
688
+ */
689
+ export declare function generateFingerprint(): Promise<HardwareFingerprint>;
690
+
691
+ export declare function generateGitHubActionsWorkflow(options: {
692
+ requiredTier?: LicenseTier;
693
+ requiredFeatures?: FeatureId[];
694
+ skipForForks?: boolean;
695
+ }): string;
696
+
697
+ export declare function generateGitLabCIPipeline(options: {
698
+ requiredTier?: LicenseTier;
699
+ }): string;
700
+
701
+ /**
702
+ * Generate license info from key options
703
+ */
704
+ export declare function generateLicenseInfo(options: LicenseKeyOptions): LicenseInfo;
705
+
706
+ /**
707
+ * Generate a new license key
708
+ * Format: XXXX-XXXX-XXXX-XXXX-XXXX
709
+ * - Segment 1: Encoded metadata (tier, date)
710
+ * - Segment 2-4: Random unique identifier
711
+ * - Segment 5: Checksum
712
+ */
713
+ export declare function generateLicenseKey(tier?: LicenseTier): LicenseKey;
714
+
715
+ /**
716
+ * Generate machine ID (stable identifier for this machine)
717
+ */
718
+ export declare function generateMachineId(): Promise<MachineId>;
719
+
720
+ /**
721
+ * Generate a protection manifest (JSON-serializable) for embedding
722
+ * in production builds.
723
+ */
724
+ export declare function generateProtectionManifest(): {
725
+ version: string;
726
+ generated: string;
727
+ modules: ProtectedModuleEntry[];
728
+ bundleTags: BundleTag[];
729
+ };
730
+
731
+ declare interface GeographicData {
732
+ country: string;
733
+ countryCode: string;
734
+ users: number;
735
+ sessions: number;
736
+ avgDuration: number;
737
+ }
738
+
739
+ /** Get modules accessible at a given tier */
740
+ export declare function getAccessibleModules(currentTier: LicenseTier): ProtectedModuleEntry[];
741
+
742
+ /**
743
+ * Get all registered features
744
+ */
745
+ export declare function getAllFeatures(): FeatureDefinition[];
746
+
747
+ /**
748
+ * Get all plans
749
+ */
750
+ export declare function getAllPlans(): LicensePlan[];
751
+
752
+ /** Get all protected module entries */
753
+ export declare function getAllProtectedModules(): ProtectedModuleEntry[];
754
+
755
+ /**
756
+ * Get all available features for a license
757
+ */
758
+ export declare function getAvailableFeatures(license: LicenseInfo | null): FeatureId[];
759
+
760
+ /**
761
+ * Get default features for tier
762
+ */
763
+ export declare function getDefaultFeatures(tier: LicenseTier): FeatureId[];
764
+
765
+ /**
766
+ * Get default max machines for tier
767
+ */
768
+ export declare function getDefaultMachines(tier: LicenseTier): number;
769
+
770
+ /**
771
+ * Get default max seats for tier
772
+ */
773
+ export declare function getDefaultSeats(tier: LicenseTier): number | null;
774
+
775
+ /**
776
+ * Get feature definition
777
+ */
778
+ export declare function getFeature(id: FeatureId): FeatureDefinition | undefined;
779
+
780
+ /**
781
+ * Get features by category
782
+ */
783
+ export declare function getFeaturesByCategory(category: string): FeatureDefinition[];
784
+
785
+ /** Get modules that require a higher tier than current */
786
+ export declare function getInaccessibleModules(currentTier: LicenseTier): ProtectedModuleEntry[];
787
+
788
+ /**
789
+ * Get missing features for upgrade promotion
790
+ */
791
+ export declare function getMissingFeatures(license: LicenseInfo | null, targetTier: LicenseTier): FeatureDefinition[];
792
+
793
+ /**
794
+ * Get or generate fingerprint (uses cached value if available)
795
+ */
796
+ export declare function getOrGenerateFingerprint(): Promise<HardwareFingerprint>;
797
+
798
+ /**
799
+ * Get plan by tier
800
+ */
801
+ export declare function getPlan(tier: LicenseTier): LicensePlan | undefined;
802
+
803
+ /** Get a protected module entry by path */
804
+ export declare function getProtectedModule(modulePath: string): ProtectedModuleEntry | undefined;
805
+
806
+ /**
807
+ * Retrieve stored fingerprint
808
+ */
809
+ export declare function getStoredFingerprint(): HardwareFingerprint | null;
810
+
811
+ /**
812
+ * Get or create global validator instance
813
+ */
814
+ export declare function getValidator(config?: Partial<LicenseServerConfig>): LicenseValidator;
815
+
816
+ /** Hardware fingerprint hash */
817
+ export declare type HardwareFingerprint = string;
818
+
819
+ /** Hardware fingerprint components */
820
+ export declare interface HardwareFingerprintData {
821
+ /** CPU identifier */
822
+ cpuId?: string;
823
+ /** Motherboard serial */
824
+ motherboardSerial?: string;
825
+ /** Disk serial */
826
+ diskSerial?: string;
827
+ /** MAC address hash */
828
+ macAddressHash?: string;
829
+ /** OS installation ID */
830
+ osInstallId?: string;
831
+ /** Browser fingerprint (for web) */
832
+ browserFingerprint?: string;
833
+ /** User agent hash */
834
+ userAgentHash?: string;
835
+ /** WebGL renderer hash */
836
+ webglHash?: string;
837
+ /** Canvas fingerprint */
838
+ canvasFingerprint?: string;
839
+ /** Audio context fingerprint */
840
+ audioFingerprint?: string;
841
+ }
842
+
843
+ /**
844
+ * Check if license has specific feature
845
+ */
846
+ export declare function hasFeature(license: LicenseInfo | null, featureId: FeatureId): boolean;
847
+
848
+ /** Hash a license key for audit storage */
849
+ export declare function hashKeyForAudit(key: LicenseKey): string;
850
+
851
+ /** Hash a license key for anonymous tracking */
852
+ export declare function hashLicenseKey(key: string): string;
853
+
854
+ /**
855
+ * Check if license meets tier requirement
856
+ */
857
+ export declare function hasTier(license: LicenseInfo | null, requiredTier: LicenseTier): boolean;
858
+
859
+ /**
860
+ * Initialize default features and plans
861
+ */
862
+ export declare function initializeDefaults(): void;
863
+
864
+ export declare interface Invoice {
865
+ id: string;
866
+ number: string;
867
+ status: 'draft' | 'open' | 'paid' | 'void' | 'uncollectible';
868
+ amount: number;
869
+ amountPaid: number;
870
+ amountDue: number;
871
+ currency: string;
872
+ createdAt: string;
873
+ dueDate: string;
874
+ paidAt?: string;
875
+ periodStart: string;
876
+ periodEnd: string;
877
+ lineItems: InvoiceLineItem[];
878
+ pdfUrl?: string;
879
+ hostedUrl?: string;
880
+ }
881
+
882
+ declare interface InvoiceInfo {
883
+ id: string;
884
+ number: string;
885
+ status: 'draft' | 'open' | 'paid' | 'void' | 'uncollectible';
886
+ amount: number;
887
+ currency: string;
888
+ issuedAt: string;
889
+ dueAt: string;
890
+ paidAt?: string;
891
+ downloadUrl?: string;
892
+ }
893
+
894
+ declare interface InvoiceLineItem {
895
+ description: string;
896
+ quantity: number;
897
+ unitPrice: number;
898
+ amount: number;
899
+ taxAmount?: number;
900
+ }
901
+
902
+ /**
903
+ * Check if feature is licensed (convenience function)
904
+ */
905
+ export declare function isFeatureLicensed(key: LicenseKey, feature: FeatureId): Promise<boolean>;
906
+
907
+ export declare function isForkPR(): boolean;
908
+
909
+ /** Check if a module is accessible for a given tier */
910
+ export declare function isModuleAccessible(modulePath: string, currentTier: LicenseTier): boolean;
911
+
912
+ export declare interface LicenseAction {
913
+ id: string;
914
+ type: 'activate' | 'deactivate' | 'transfer' | 'upgrade' | 'renew' | 'revoke';
915
+ licenseKey: LicenseKey;
916
+ timestamp: string;
917
+ performedBy: string;
918
+ details?: Record<string, unknown>;
919
+ }
920
+
921
+ /** License card component */
922
+ export declare const LicenseCard: default_2.FC<{
923
+ license: LicenseInfo;
924
+ onSelect?: () => void;
925
+ onActivate?: () => void;
926
+ onDeactivate?: () => void;
927
+ selected?: boolean;
928
+ }>;
929
+
930
+ /** License error codes */
931
+ export declare type LicenseErrorCode = 'INVALID_KEY' | 'EXPIRED' | 'REVOKED' | 'MACHINE_LIMIT' | 'SEAT_LIMIT' | 'FEATURE_NOT_LICENSED' | 'NETWORK_ERROR' | 'SERVER_ERROR' | 'TAMPERED' | 'CLOCK_SKEW';
932
+
933
+ export declare interface LicenseFeatureGate {
934
+ featureId: FeatureId;
935
+ requiredTier: LicenseTier;
936
+ requiredFeature?: FeatureId;
937
+ files: string[];
938
+ replacement?: string;
939
+ }
940
+
941
+ /** License metadata */
942
+ export declare interface LicenseInfo {
943
+ /** Unique license key */
944
+ key: LicenseKey;
945
+ /** License tier */
946
+ tier: LicenseTier;
947
+ /** Current status */
948
+ status: LicenseStatus;
949
+ /** Organization/User name */
950
+ licensee: string;
951
+ /** Contact email */
952
+ email: string;
953
+ /** Issue date (ISO 8601) */
954
+ issuedAt: string;
955
+ /** Expiration date (ISO 8601), null for perpetual */
956
+ expiresAt: string | null;
957
+ /** Grace period end date (ISO 8601) */
958
+ graceUntil?: string;
959
+ /** Enabled feature flags */
960
+ features: FeatureId[];
961
+ /** Maximum seats (users), null for unlimited */
962
+ maxSeats: number | null;
963
+ /** Currently active seats */
964
+ activeSeats: number;
965
+ /** Bound hardware fingerprints */
966
+ boundMachines: MachineId[];
967
+ /** Maximum machines allowed */
968
+ maxMachines: number;
969
+ /** Floating license pool size */
970
+ floatingSeats?: number;
971
+ /** Custom metadata */
972
+ metadata?: Record<string, unknown>;
973
+ }
974
+
975
+ /** License key format: XXXX-XXXX-XXXX-XXXX-XXXX */
976
+ export declare type LicenseKey = string;
977
+
978
+ /** License key generation options */
979
+ export declare interface LicenseKeyOptions {
980
+ /** License tier */
981
+ tier: LicenseTier;
982
+ /** Licensee name */
983
+ licensee: string;
984
+ /** Contact email */
985
+ email: string;
986
+ /** Duration in days, null for perpetual */
987
+ durationDays: number | null;
988
+ /** Grace period in days after expiration */
989
+ graceDays?: number;
990
+ /** Features to enable */
991
+ features?: FeatureId[];
992
+ /** Max seats */
993
+ maxSeats?: number | null;
994
+ /** Max machines for hardware binding */
995
+ maxMachines?: number;
996
+ /** Floating seats for concurrent use */
997
+ floatingSeats?: number;
998
+ /** Custom metadata */
999
+ metadata?: Record<string, unknown>;
1000
+ }
1001
+
1002
+ /** License comparison plan */
1003
+ export declare interface LicensePlan {
1004
+ /** Plan ID (maps to tier) */
1005
+ id: LicenseTier;
1006
+ /** Display name */
1007
+ name: string;
1008
+ /** Description */
1009
+ description: string;
1010
+ /** Price per month (cents) */
1011
+ priceMonthly: number;
1012
+ /** Price per year (cents) */
1013
+ priceYearly: number;
1014
+ /** Included features */
1015
+ features: FeatureId[];
1016
+ /** Max seats */
1017
+ maxSeats: number | null;
1018
+ /** Max machines */
1019
+ maxMachines: number;
1020
+ /** Highlights for marketing */
1021
+ highlights: string[];
1022
+ /** Is recommended */
1023
+ recommended?: boolean;
1024
+ }
1025
+
1026
+ /** Main License Portal component */
1027
+ export declare const LicensePortal: default_2.FC<LicensePortalProps>;
1028
+
1029
+ export declare interface LicensePortalConfig {
1030
+ /** API base URL for license operations */
1031
+ apiBaseUrl: string;
1032
+ /** Authentication token */
1033
+ authToken?: string;
1034
+ /** Customer/Organization ID */
1035
+ customerId: string;
1036
+ /** Enable dark mode */
1037
+ darkMode?: boolean;
1038
+ /** Locale for date/number formatting */
1039
+ locale?: string;
1040
+ /** Currency code for billing */
1041
+ currency?: string;
1042
+ /** Show billing section */
1043
+ showBilling?: boolean;
1044
+ /** Show usage analytics */
1045
+ showAnalytics?: boolean;
1046
+ /** Allow license transfers */
1047
+ allowTransfers?: boolean;
1048
+ /** Allow seat management */
1049
+ allowSeatManagement?: boolean;
1050
+ /** Custom theme colors */
1051
+ theme?: LicensePortalTheme;
1052
+ /** Callback when license is activated */
1053
+ onLicenseActivated?: (license: LicenseInfo) => void;
1054
+ /** Callback when license is deactivated */
1055
+ onLicenseDeactivated?: (licenseKey: LicenseKey) => void;
1056
+ /** Callback on error */
1057
+ onError?: (error: LicensePortalError) => void;
1058
+ }
1059
+
1060
+ declare interface LicensePortalError {
1061
+ code: string;
1062
+ message: string;
1063
+ details?: Record<string, unknown>;
1064
+ }
1065
+
1066
+ declare interface LicensePortalProps extends LicensePortalConfig {
1067
+ className?: string;
1068
+ style?: default_2.CSSProperties;
1069
+ }
1070
+
1071
+ export declare class LicensePortalService {
1072
+ private config;
1073
+ constructor(config: LicensePortalConfig);
1074
+ private request;
1075
+ /** Get customer license overview */
1076
+ getOverview(): Promise<CustomerLicenseOverview>;
1077
+ /** Get detailed license info */
1078
+ getLicense(licenseKey: LicenseKey): Promise<LicenseInfo>;
1079
+ /** Activate license on current machine */
1080
+ activateLicense(licenseKey: LicenseKey, machineId: string, machineName?: string): Promise<LicenseInfo>;
1081
+ /** Deactivate license from machine */
1082
+ deactivateLicense(licenseKey: LicenseKey, machineId: string): Promise<void>;
1083
+ /** Transfer license to another user/org */
1084
+ transferLicense(licenseKey: LicenseKey, targetEmail: string, notes?: string): Promise<{
1085
+ transferId: string;
1086
+ status: string;
1087
+ }>;
1088
+ /** Get seat assignments */
1089
+ getSeats(licenseKey: LicenseKey): Promise<SeatInfo[]>;
1090
+ /** Assign seat to user */
1091
+ assignSeat(licenseKey: LicenseKey, userId: string, email: string): Promise<SeatInfo>;
1092
+ /** Remove seat assignment */
1093
+ removeSeat(licenseKey: LicenseKey, seatId: string): Promise<void>;
1094
+ /** Get subscription info */
1095
+ getSubscription(): Promise<SubscriptionInfo | null>;
1096
+ /** Get invoices */
1097
+ getInvoices(limit?: number, offset?: number): Promise<{
1098
+ invoices: InvoiceInfo[];
1099
+ total: number;
1100
+ }>;
1101
+ /** Get action history */
1102
+ getActionHistory(licenseKey?: LicenseKey, limit?: number): Promise<LicenseAction[]>;
1103
+ /** Request license renewal */
1104
+ requestRenewal(licenseKey: LicenseKey): Promise<{
1105
+ checkoutUrl: string;
1106
+ }>;
1107
+ /** Request tier upgrade */
1108
+ requestUpgrade(licenseKey: LicenseKey, targetTier: LicenseTier): Promise<{
1109
+ checkoutUrl: string;
1110
+ proratedAmount: number;
1111
+ }>;
1112
+ }
1113
+
1114
+ declare interface LicensePortalState {
1115
+ loading: boolean;
1116
+ error: LicensePortalError | null;
1117
+ overview: CustomerLicenseOverview | null;
1118
+ selectedLicense: LicenseInfo | null;
1119
+ actionHistory: LicenseAction[];
1120
+ subscription: SubscriptionInfo | null;
1121
+ invoices: InvoiceInfo[];
1122
+ activeTab: 'overview' | 'licenses' | 'seats' | 'billing' | 'analytics' | 'settings';
1123
+ }
1124
+
1125
+ declare interface LicensePortalTheme {
1126
+ primaryColor: string;
1127
+ secondaryColor: string;
1128
+ backgroundColor: string;
1129
+ surfaceColor: string;
1130
+ textColor: string;
1131
+ errorColor: string;
1132
+ successColor: string;
1133
+ warningColor: string;
1134
+ }
1135
+
1136
+ /** License server configuration */
1137
+ export declare interface LicenseServerConfig {
1138
+ /** Server URL */
1139
+ serverUrl: string;
1140
+ /** API key for server communication */
1141
+ apiKey?: string;
1142
+ /** Request timeout in ms */
1143
+ timeout?: number;
1144
+ /** Retry attempts */
1145
+ retries?: number;
1146
+ /** Cache TTL in seconds */
1147
+ cacheTtl?: number;
1148
+ /** Enable offline mode */
1149
+ offlineMode?: boolean;
1150
+ /** Telemetry opt-in */
1151
+ telemetryEnabled?: boolean;
1152
+ }
1153
+
1154
+ /** License store state */
1155
+ export declare interface LicenseState {
1156
+ /** Current license info */
1157
+ license: LicenseInfo | null;
1158
+ /** Validation result */
1159
+ validation: LicenseValidationResult | null;
1160
+ /** Is loading */
1161
+ loading: boolean;
1162
+ /** Last error */
1163
+ error: string | null;
1164
+ /** Available features (computed) */
1165
+ features: Set<FeatureId>;
1166
+ /** Hardware fingerprint */
1167
+ fingerprint: HardwareFingerprint | null;
1168
+ }
1169
+
1170
+ /** License status */
1171
+ export declare type LicenseStatus = 'valid' | 'expired' | 'revoked' | 'invalid' | 'grace' | 'pending';
1172
+
1173
+ /** License status badge */
1174
+ export declare const LicenseStatusBadge: default_2.FC<{
1175
+ status: LicenseStatus;
1176
+ size?: 'sm' | 'md' | 'lg';
1177
+ }>;
1178
+
1179
+ /** License tier levels */
1180
+ export declare type LicenseTier = 'trial' | 'personal' | 'team' | 'enterprise' | 'site' | 'oem';
1181
+
1182
+ /** License tier badge */
1183
+ export declare const LicenseTierBadge: default_2.FC<{
1184
+ tier: LicenseTier;
1185
+ size?: 'sm' | 'md' | 'lg';
1186
+ }>;
1187
+
1188
+ /** License Transfer Wizard */
1189
+ export declare const LicenseTransfer: default_2.FC<LicenseTransferProps>;
1190
+
1191
+ declare interface LicenseTransferProps extends TransferConfig {
1192
+ className?: string;
1193
+ style?: default_2.CSSProperties;
1194
+ }
1195
+
1196
+ export declare class LicenseTransferService {
1197
+ private config;
1198
+ constructor(config: TransferConfig);
1199
+ private request;
1200
+ /** Get transferable licenses */
1201
+ getTransferableLicenses(): Promise<LicenseInfo[]>;
1202
+ /** Validate recipient email/organization */
1203
+ validateRecipient(email: string): Promise<{
1204
+ valid: boolean;
1205
+ recipientInfo?: TransferParty;
1206
+ isExternal: boolean;
1207
+ warnings?: string[];
1208
+ }>;
1209
+ /** Initiate transfer */
1210
+ initiateTransfer(data: {
1211
+ licenseKey: string;
1212
+ recipientEmail: string;
1213
+ recipientName: string;
1214
+ notes?: string;
1215
+ reason: string;
1216
+ }): Promise<TransferRequest>;
1217
+ /** Get transfer by ID */
1218
+ getTransfer(transferId: string): Promise<TransferRequest>;
1219
+ /** Get pending transfers */
1220
+ getPendingTransfers(): Promise<TransferRequest[]>;
1221
+ /** Get transfer history */
1222
+ getTransferHistory(licenseKey?: string): Promise<TransferRequest[]>;
1223
+ /** Cancel transfer */
1224
+ cancelTransfer(transferId: string, reason?: string): Promise<TransferRequest>;
1225
+ /** Accept transfer (as recipient) */
1226
+ acceptTransfer(transferId: string, token: string): Promise<TransferRequest>;
1227
+ /** Approve transfer (admin) */
1228
+ approveTransfer(transferId: string): Promise<TransferRequest>;
1229
+ /** Reject transfer (admin) */
1230
+ rejectTransfer(transferId: string, reason: string): Promise<TransferRequest>;
1231
+ }
1232
+
1233
+ declare interface LicenseUtilizationData {
1234
+ licenseKey: string;
1235
+ tier: LicenseTier;
1236
+ licensee: string;
1237
+ totalSeats: number;
1238
+ usedSeats: number;
1239
+ utilizationPercent: number;
1240
+ lastActivity: string;
1241
+ activeUsersLast30d: number;
1242
+ }
1243
+
1244
+ /** License validation result */
1245
+ export declare interface LicenseValidationResult {
1246
+ /** Is the license valid */
1247
+ valid: boolean;
1248
+ /** License info if valid */
1249
+ license?: LicenseInfo;
1250
+ /** Error code if invalid */
1251
+ errorCode?: LicenseErrorCode;
1252
+ /** Human-readable error message */
1253
+ errorMessage?: string;
1254
+ /** Days until expiration */
1255
+ daysRemaining?: number;
1256
+ /** Is in grace period */
1257
+ inGracePeriod?: boolean;
1258
+ /** Features available */
1259
+ availableFeatures?: FeatureId[];
1260
+ /** Validation timestamp */
1261
+ validatedAt: string;
1262
+ }
1263
+
1264
+ /**
1265
+ * License Validator Service
1266
+ */
1267
+ export declare class LicenseValidator {
1268
+ private config;
1269
+ private cache;
1270
+ constructor(config?: Partial<LicenseServerConfig>);
1271
+ /**
1272
+ * Validate a license key
1273
+ */
1274
+ validate(key: LicenseKey, fingerprint?: HardwareFingerprint): Promise<LicenseValidationResult>;
1275
+ /**
1276
+ * Online license validation
1277
+ */
1278
+ private validateOnline;
1279
+ /**
1280
+ * Parse server validation response
1281
+ */
1282
+ private parseServerResponse;
1283
+ /**
1284
+ * Offline license validation
1285
+ */
1286
+ private validateOffline;
1287
+ /**
1288
+ * Generate offline activation challenge
1289
+ */
1290
+ generateChallenge(key: LicenseKey): Promise<OfflineChallenge>;
1291
+ /**
1292
+ * Apply offline activation response
1293
+ */
1294
+ applyOfflineResponse(response: OfflineResponse): LicenseValidationResult;
1295
+ /**
1296
+ * Check if feature is available
1297
+ */
1298
+ hasFeature(key: LicenseKey, feature: FeatureId): Promise<boolean>;
1299
+ /**
1300
+ * Activate machine for license
1301
+ */
1302
+ activateMachine(key: LicenseKey): Promise<LicenseValidationResult>;
1303
+ /**
1304
+ * Deactivate machine from license
1305
+ */
1306
+ deactivateMachine(key: LicenseKey): Promise<boolean>;
1307
+ private getFromCache;
1308
+ private setCache;
1309
+ private clearCache;
1310
+ private getStoredLicense;
1311
+ private storeLicense;
1312
+ private clearStoredLicense;
1313
+ private loadCacheFromStorage;
1314
+ private saveCacheToStorage;
1315
+ private getMachineName;
1316
+ }
1317
+
1318
+ /** Machine identifier */
1319
+ export declare type MachineId = string;
1320
+
1321
+ /**
1322
+ * Mask license key for display (show first and last segments)
1323
+ */
1324
+ export declare function maskLicenseKey(key: LicenseKey): string;
1325
+
1326
+ declare type MetricGranularity = 'hour' | 'day' | 'week' | 'month';
1327
+
1328
+ export declare function nice2devLicenseRollupPlugin(options?: BuildLicenseConfig): any;
1329
+
1330
+ export declare function nice2devLicenseVitePlugin(options?: Nice2DevLicenseVitePluginOptions): any;
1331
+
1332
+ export declare interface Nice2DevLicenseVitePluginOptions extends BuildLicenseConfig {
1333
+ featureGates?: LicenseFeatureGate[];
1334
+ }
1335
+
1336
+ export declare class Nice2DevLicenseWebpackPlugin {
1337
+ private validator;
1338
+ private options;
1339
+ private validated;
1340
+ constructor(options?: Nice2DevLicenseWebpackPluginOptions);
1341
+ apply(compiler: any): void;
1342
+ }
1343
+
1344
+ export declare interface Nice2DevLicenseWebpackPluginOptions extends BuildLicenseConfig {
1345
+ /** Feature gates to apply */
1346
+ featureGates?: LicenseFeatureGate[];
1347
+ }
1348
+
1349
+ /**
1350
+ * Parse license key from various formats (with or without dashes)
1351
+ */
1352
+ export declare function normalizeLicenseKey(input: string): LicenseKey | null;
1353
+
1354
+ /** Offline activation challenge */
1355
+ export declare interface OfflineChallenge {
1356
+ /** Challenge ID */
1357
+ challengeId: string;
1358
+ /** Challenge code (base64) */
1359
+ challengeCode: string;
1360
+ /** Hardware fingerprint */
1361
+ fingerprint: HardwareFingerprint;
1362
+ /** Expiration timestamp */
1363
+ expiresAt: string;
1364
+ }
1365
+
1366
+ /** Offline activation response */
1367
+ export declare interface OfflineResponse {
1368
+ /** Challenge ID being responded to */
1369
+ challengeId: string;
1370
+ /** Response code (base64) */
1371
+ responseCode: string;
1372
+ /** License data (encrypted) */
1373
+ licenseData: string;
1374
+ }
1375
+
1376
+ export declare interface OverviewMetrics {
1377
+ /** Total active licenses */
1378
+ activeLicenses: number;
1379
+ activeLicensesChange: number;
1380
+ /** Total active users */
1381
+ activeUsers: number;
1382
+ activeUsersChange: number;
1383
+ /** Total feature uses */
1384
+ featureUses: number;
1385
+ featureUsesChange: number;
1386
+ /** Average session duration (minutes) */
1387
+ avgSessionDuration: number;
1388
+ avgSessionDurationChange: number;
1389
+ /** License utilization rate */
1390
+ utilizationRate: number;
1391
+ utilizationRateChange: number;
1392
+ }
1393
+
1394
+ export declare interface PaymentMethod {
1395
+ id: string;
1396
+ type: 'card' | 'bank_account' | 'paypal' | 'sepa_debit';
1397
+ brand?: string;
1398
+ last4: string;
1399
+ expiryMonth?: number;
1400
+ expiryYear?: number;
1401
+ isDefault: boolean;
1402
+ }
1403
+
1404
+ declare interface PaymentMethodInfo {
1405
+ type: 'card' | 'bank_account' | 'paypal';
1406
+ brand?: string;
1407
+ last4?: string;
1408
+ expiryMonth?: number;
1409
+ expiryYear?: number;
1410
+ }
1411
+
1412
+ export declare type PaymentProvider = 'stripe' | 'paddle' | 'paypal';
1413
+
1414
+ export declare interface PricingPlan {
1415
+ id: string;
1416
+ name: string;
1417
+ description: string;
1418
+ tier: LicenseTier;
1419
+ features: string[];
1420
+ /** Monthly price in cents */
1421
+ monthlyPrice: number;
1422
+ /** Yearly price in cents (with discount) */
1423
+ yearlyPrice: number;
1424
+ /** One-time price in cents (perpetual) */
1425
+ perpetualPrice?: number;
1426
+ currency: string;
1427
+ /** Seats included */
1428
+ seatsIncluded: number;
1429
+ /** Price per additional seat (monthly) */
1430
+ seatPriceMonthly?: number;
1431
+ /** Price per additional seat (yearly) */
1432
+ seatPriceYearly?: number;
1433
+ /** Trial days */
1434
+ trialDays?: number;
1435
+ /** Is highlighted/recommended */
1436
+ recommended?: boolean;
1437
+ /** Stripe price IDs */
1438
+ stripePriceIds?: {
1439
+ monthly?: string;
1440
+ yearly?: string;
1441
+ perpetual?: string;
1442
+ };
1443
+ /** Paddle product IDs */
1444
+ paddleProductIds?: {
1445
+ monthly?: string;
1446
+ yearly?: string;
1447
+ perpetual?: string;
1448
+ };
1449
+ }
1450
+
1451
+ declare interface ProratedAmount {
1452
+ dueNow: number;
1453
+ credit: number;
1454
+ newRecurring: number;
1455
+ effectiveDate: string;
1456
+ }
1457
+
1458
+ /** Manifest entry describing a protected module */
1459
+ export declare interface ProtectedModuleEntry {
1460
+ /** Module / component path (relative to package root) */
1461
+ modulePath: string;
1462
+ /** Minimum tier required to access source */
1463
+ requiredTier: LicenseTier;
1464
+ /** Required feature ID (if any) */
1465
+ requiredFeature?: FeatureId;
1466
+ /** Protection level */
1467
+ accessLevel: SourceAccessLevel;
1468
+ /** Human-readable name */
1469
+ displayName: string;
1470
+ /** Description of what the module provides */
1471
+ description?: string;
1472
+ }
1473
+
1474
+ /** Rate limit configuration keyed by tier */
1475
+ export declare type RateLimitConfig = Record<LicenseTier, TierRateLimit>;
1476
+
1477
+ /**
1478
+ * Token-bucket rate limiter.
1479
+ * Refills tokens at a constant rate up to the max capacity.
1480
+ */
1481
+ export declare class RateLimiter {
1482
+ private tokens;
1483
+ private lastRefill;
1484
+ private config;
1485
+ constructor(config: TierRateLimit);
1486
+ /** Refill tokens based on elapsed time */
1487
+ private refill;
1488
+ /** Check and consume one request token */
1489
+ consume(): RateLimitResult;
1490
+ /** Reset the limiter (e.g. after tier change) */
1491
+ reset(config?: TierRateLimit): void;
1492
+ /** Peek at remaining tokens without consuming */
1493
+ peek(): RateLimitResult;
1494
+ }
1495
+
1496
+ /** Result of a rate limit check */
1497
+ export declare interface RateLimitResult {
1498
+ /** Whether the request is allowed */
1499
+ allowed: boolean;
1500
+ /** Remaining requests in the current window */
1501
+ remaining: number;
1502
+ /** Time in ms until the next token is available (0 if allowed) */
1503
+ retryAfterMs: number;
1504
+ /** Total limit for the tier */
1505
+ limit: number;
1506
+ }
1507
+
1508
+ declare interface RefundAttachment {
1509
+ id: string;
1510
+ filename: string;
1511
+ mimeType: string;
1512
+ size: number;
1513
+ uploadedAt: string;
1514
+ url: string;
1515
+ }
1516
+
1517
+ export declare interface RefundConfig {
1518
+ apiBaseUrl: string;
1519
+ authToken?: string;
1520
+ policy: RefundPolicy;
1521
+ /** Notification configuration */
1522
+ notifications?: {
1523
+ customerEmail: boolean;
1524
+ adminEmail: boolean;
1525
+ slackWebhook?: string;
1526
+ };
1527
+ /** Callback when refund is processed */
1528
+ onRefundProcessed?: (request: RefundRequest) => void;
1529
+ /** Callback when license is revoked */
1530
+ onLicenseRevoked?: (record: RevocationRecord) => void;
1531
+ }
1532
+
1533
+ declare interface RefundEligibility {
1534
+ eligible: boolean;
1535
+ reason?: string;
1536
+ maxRefundAmount: number;
1537
+ refundPercent: number;
1538
+ withinPeriod: boolean;
1539
+ daysRemaining: number;
1540
+ previousRefunds: number;
1541
+ requiresApproval: boolean;
1542
+ }
1543
+
1544
+ export declare interface RefundPolicy {
1545
+ /** Days after purchase when refund is allowed */
1546
+ refundPeriodDays: number;
1547
+ /** Tiers eligible for automatic refund */
1548
+ autoApprovalTiers: LicenseTier[];
1549
+ /** Max amount for auto-approval */
1550
+ autoApprovalMaxAmount: number;
1551
+ /** Max refunds per customer per year */
1552
+ maxRefundsPerYear: number;
1553
+ /** Requires reason to be provided */
1554
+ requireReason: boolean;
1555
+ /** Requires detailed explanation */
1556
+ requireDetails: boolean;
1557
+ /** Percentage refund after usage (0-100) */
1558
+ usageBasedRefundPercent?: number;
1559
+ /** Days where full refund applies */
1560
+ fullRefundDays: number;
1561
+ /** Partial refund after full refund period */
1562
+ partialRefundPercent?: number;
1563
+ /** Excluded tiers from refund */
1564
+ excludedTiers?: LicenseTier[];
1565
+ /** Custom rules per tier */
1566
+ tierRules?: Record<LicenseTier, {
1567
+ refundPeriodDays: number;
1568
+ maxRefundPercent: number;
1569
+ }>;
1570
+ }
1571
+
1572
+ export declare type RefundReason = 'product_not_as_described' | 'technical_issues' | 'accidental_purchase' | 'no_longer_needed' | 'found_alternative' | 'pricing_concerns' | 'customer_service' | 'other';
1573
+
1574
+ export declare interface RefundRequest {
1575
+ id: string;
1576
+ customerId: string;
1577
+ customerEmail: string;
1578
+ customerName: string;
1579
+ licenseKey: LicenseKey;
1580
+ license: LicenseInfo;
1581
+ orderId: string;
1582
+ invoiceId?: string;
1583
+ amount: number;
1584
+ currency: string;
1585
+ reason: RefundReason;
1586
+ reasonDetails?: string;
1587
+ status: RefundStatus;
1588
+ createdAt: string;
1589
+ updatedAt: string;
1590
+ processedAt?: string;
1591
+ processedBy?: string;
1592
+ refundMethod: 'original_payment' | 'store_credit' | 'manual';
1593
+ refundTransactionId?: string;
1594
+ rejectionReason?: string;
1595
+ notes?: string;
1596
+ attachments?: RefundAttachment[];
1597
+ autoApproved: boolean;
1598
+ withinRefundPeriod: boolean;
1599
+ daysFromPurchase: number;
1600
+ }
1601
+
1602
+ export declare class RefundService {
1603
+ private config;
1604
+ constructor(config: RefundConfig);
1605
+ private request;
1606
+ /** Check if license is eligible for refund */
1607
+ checkEligibility(licenseKey: LicenseKey): Promise<RefundEligibility>;
1608
+ /** Calculate refund amount */
1609
+ calculateRefundAmount(originalAmount: number, daysSincePurchase: number): {
1610
+ amount: number;
1611
+ percent: number;
1612
+ };
1613
+ /** Create refund request */
1614
+ createRefundRequest(data: {
1615
+ licenseKey: LicenseKey;
1616
+ reason: RefundReason;
1617
+ reasonDetails?: string;
1618
+ preferredMethod?: RefundRequest['refundMethod'];
1619
+ }): Promise<RefundRequest>;
1620
+ /** Get refund request by ID */
1621
+ getRefundRequest(requestId: string): Promise<RefundRequest>;
1622
+ /** Get refund requests for customer */
1623
+ getCustomerRefundRequests(customerId?: string): Promise<RefundRequest[]>;
1624
+ /** Get pending refund requests (admin) */
1625
+ getPendingRequests(limit?: number, offset?: number): Promise<{
1626
+ requests: RefundRequest[];
1627
+ total: number;
1628
+ }>;
1629
+ /** Cancel refund request (customer) */
1630
+ cancelRefundRequest(requestId: string): Promise<RefundRequest>;
1631
+ /** Add attachment to refund request */
1632
+ addAttachment(requestId: string, file: File): Promise<RefundAttachment>;
1633
+ /** Approve refund request (admin) */
1634
+ approveRefund(requestId: string, options?: {
1635
+ adjustedAmount?: number;
1636
+ notes?: string;
1637
+ refundMethod?: RefundRequest['refundMethod'];
1638
+ }): Promise<RefundRequest>;
1639
+ /** Reject refund request (admin) */
1640
+ rejectRefund(requestId: string, reason: string): Promise<RefundRequest>;
1641
+ /** Process refund (trigger payment refund) */
1642
+ processRefund(requestId: string): Promise<RefundRequest>;
1643
+ /** Revoke license */
1644
+ revokeLicense(licenseKey: LicenseKey, reason: RevocationReason, options?: {
1645
+ reasonDetails?: string;
1646
+ permanent?: boolean;
1647
+ notifyCustomer?: boolean;
1648
+ refundRequestId?: string;
1649
+ }): Promise<RevocationRecord>;
1650
+ /** Get revocation history */
1651
+ getRevocationHistory(licenseKey?: LicenseKey): Promise<RevocationRecord[]>;
1652
+ /** Reactivate revoked license (if allowed) */
1653
+ reactivateLicense(revocationId: string, reason: string): Promise<{
1654
+ success: boolean;
1655
+ license?: LicenseInfo;
1656
+ }>;
1657
+ /** Get refund statistics */
1658
+ getRefundStats(startDate: string, endDate: string): Promise<{
1659
+ totalRequests: number;
1660
+ totalRefunded: number;
1661
+ totalRejected: number;
1662
+ totalAmount: number;
1663
+ averageAmount: number;
1664
+ byReason: Record<RefundReason, number>;
1665
+ byStatus: Record<RefundStatus, number>;
1666
+ averageProcessingTime: number;
1667
+ autoApprovalRate: number;
1668
+ }>;
1669
+ }
1670
+
1671
+ export declare type RefundStatus = 'pending' | 'approved' | 'rejected' | 'processing' | 'completed' | 'failed' | 'cancelled';
1672
+
1673
+ /**
1674
+ * Register a feature definition
1675
+ */
1676
+ export declare function registerFeature(feature: FeatureDefinition): void;
1677
+
1678
+ /**
1679
+ * Register multiple features
1680
+ */
1681
+ export declare function registerFeatures(features: FeatureDefinition[]): void;
1682
+
1683
+ /**
1684
+ * Register a license plan
1685
+ */
1686
+ export declare function registerPlan(plan: LicensePlan): void;
1687
+
1688
+ /**
1689
+ * Register multiple plans
1690
+ */
1691
+ export declare function registerPlans(plans: LicensePlan[]): void;
1692
+
1693
+ /** Register a module as protected */
1694
+ export declare function registerProtectedModule(entry: ProtectedModuleEntry): void;
1695
+
1696
+ /** Register multiple protected modules */
1697
+ export declare function registerProtectedModules(entries: ProtectedModuleEntry[]): void;
1698
+
1699
+ declare type RevocationReason = 'refund' | 'chargeback' | 'fraud' | 'violation' | 'breach_of_terms' | 'payment_failure' | 'admin_action' | 'license_transfer';
1700
+
1701
+ export declare interface RevocationRecord {
1702
+ id: string;
1703
+ licenseKey: LicenseKey;
1704
+ license: LicenseInfo;
1705
+ reason: RevocationReason;
1706
+ reasonDetails?: string;
1707
+ revokedAt: string;
1708
+ revokedBy: string;
1709
+ refundRequestId?: string;
1710
+ permanent: boolean;
1711
+ reactivatable: boolean;
1712
+ previousStatus: string;
1713
+ affectedSeats: number;
1714
+ affectedMachines: string[];
1715
+ notificationsSent: boolean;
1716
+ }
1717
+
1718
+ export declare function runCILicenseCheck(options?: CILicenseCheckOptions): Promise<CILicenseCheckResult>;
1719
+
1720
+ /** Seat information */
1721
+ export declare interface SeatInfo {
1722
+ /** Seat ID */
1723
+ seatId: string;
1724
+ /** User identifier */
1725
+ userId: string;
1726
+ /** User display name */
1727
+ displayName: string;
1728
+ /** User email */
1729
+ email: string;
1730
+ /** Machine ID where active */
1731
+ machineId?: MachineId;
1732
+ /** Last activity timestamp */
1733
+ lastActivity: string;
1734
+ /** Is currently active */
1735
+ isActive: boolean;
1736
+ /** Activation timestamp */
1737
+ activatedAt: string;
1738
+ }
1739
+
1740
+ /**
1741
+ * Seat Manager for tracking license usage
1742
+ */
1743
+ export declare class SeatManager {
1744
+ private serverUrl;
1745
+ private apiKey?;
1746
+ private heartbeatInterval?;
1747
+ private currentSeat?;
1748
+ constructor(serverUrl: string, apiKey?: string);
1749
+ /**
1750
+ * Acquire a seat for the current user
1751
+ */
1752
+ acquireSeat(licenseKey: LicenseKey, userId: string, displayName: string, email: string): Promise<{
1753
+ success: boolean;
1754
+ seat?: SeatInfo;
1755
+ error?: string;
1756
+ }>;
1757
+ /**
1758
+ * Release current seat
1759
+ */
1760
+ releaseSeat(licenseKey: LicenseKey): Promise<boolean>;
1761
+ /**
1762
+ * Get all active seats for a license
1763
+ */
1764
+ getActiveSeats(licenseKey: LicenseKey): Promise<SeatInfo[]>;
1765
+ /**
1766
+ * Force release a seat (admin function)
1767
+ */
1768
+ forceReleaseSeat(licenseKey: LicenseKey, seatId: string): Promise<boolean>;
1769
+ /**
1770
+ * Check if seat limit is reached
1771
+ */
1772
+ canAcquireSeat(license: LicenseInfo): Promise<boolean>;
1773
+ /**
1774
+ * Start heartbeat to keep seat active
1775
+ */
1776
+ private startHeartbeat;
1777
+ /**
1778
+ * Stop heartbeat
1779
+ */
1780
+ private stopHeartbeat;
1781
+ /**
1782
+ * Get current seat info
1783
+ */
1784
+ getCurrentSeat(): SeatInfo | undefined;
1785
+ /**
1786
+ * Cleanup on unmount/close
1787
+ */
1788
+ cleanup(licenseKey: LicenseKey): Promise<void>;
1789
+ }
1790
+
1791
+ /** SLA event record (uptime check, support ticket, etc.) */
1792
+ export declare interface SlaEvent {
1793
+ /** Event ID */
1794
+ id: string;
1795
+ /** Event type */
1796
+ type: 'uptime-check' | 'downtime-start' | 'downtime-end' | 'ticket-opened' | 'ticket-resolved';
1797
+ /** ISO timestamp */
1798
+ timestamp: string;
1799
+ /** Duration in ms (for downtime or resolution) */
1800
+ durationMs?: number;
1801
+ /** Associated metadata */
1802
+ metadata?: Record<string, unknown>;
1803
+ }
1804
+
1805
+ /** SLA compliance report */
1806
+ export declare interface SlaReport {
1807
+ /** Reporting period start (ISO) */
1808
+ periodStart: string;
1809
+ /** Reporting period end (ISO) */
1810
+ periodEnd: string;
1811
+ /** License tier */
1812
+ tier: LicenseTier;
1813
+ /** SLA config for this tier */
1814
+ slaConfig: SlaTierConfig;
1815
+ /** Actual uptime percentage */
1816
+ actualUptimePercent: number;
1817
+ /** Total downtime in ms */
1818
+ totalDowntimeMs: number;
1819
+ /** Average support response time (hours) */
1820
+ avgResponseHours: number;
1821
+ /** Average resolution time (hours) */
1822
+ avgResolutionHours: number;
1823
+ /** Number of SLA breaches */
1824
+ breachCount: number;
1825
+ /** Is SLA compliant */
1826
+ compliant: boolean;
1827
+ /** Credit owed (if breached) */
1828
+ creditPercent: number;
1829
+ }
1830
+
1831
+ /** SLA configuration for a single tier */
1832
+ export declare interface SlaTierConfig {
1833
+ /** Guaranteed uptime percentage (e.g. 99.9) */
1834
+ uptimePercent: number;
1835
+ /** Maximum response time for support (hours) */
1836
+ supportResponseHours: number;
1837
+ /** Maximum resolution time (hours) */
1838
+ supportResolutionHours: number;
1839
+ /** Support channels available */
1840
+ supportChannels: SupportChannel[];
1841
+ /** Priority level (1 = highest) */
1842
+ priority: number;
1843
+ /** Included support hours per month (null = unlimited) */
1844
+ includedHours: number | null;
1845
+ /** Penalty per SLA breach (as percentage credit) */
1846
+ breachPenaltyPercent: number;
1847
+ }
1848
+
1849
+ /**
1850
+ * SLA Tracker — Monitors and reports SLA compliance
1851
+ */
1852
+ export declare class SlaTracker {
1853
+ private events;
1854
+ private tier;
1855
+ private config;
1856
+ constructor(tier: LicenseTier, config?: Record<LicenseTier, SlaTierConfig>);
1857
+ /** Update the license tier */
1858
+ setTier(tier: LicenseTier): void;
1859
+ /** Get the SLA config for the current tier */
1860
+ getSlaConfig(): SlaTierConfig;
1861
+ /** Record an event */
1862
+ recordEvent(event: SlaEvent): void;
1863
+ /** Record an uptime check */
1864
+ recordUptimeCheck(): void;
1865
+ /** Record downtime */
1866
+ recordDowntime(durationMs: number): void;
1867
+ /** Record a support ticket lifecycle */
1868
+ recordTicket(responseTimeHours: number, resolutionTimeHours: number): void;
1869
+ /** Generate an SLA report for a given period */
1870
+ generateReport(periodStart: Date, periodEnd: Date): SlaReport;
1871
+ /** Get all recorded events */
1872
+ getEvents(): SlaEvent[];
1873
+ /** Clear all events */
1874
+ clearEvents(): void;
1875
+ }
1876
+
1877
+ /** Access level for a protected component / module */
1878
+ export declare type SourceAccessLevel = 'open' | 'obfuscated' | 'encrypted' | 'server-only';
1879
+
1880
+ /**
1881
+ * Store fingerprint in local storage
1882
+ */
1883
+ export declare function storeFingerprint(fingerprint: HardwareFingerprint): void;
1884
+
1885
+ export declare interface Subscription {
1886
+ id: string;
1887
+ customerId: string;
1888
+ status: SubscriptionStatus;
1889
+ plan: PricingPlan;
1890
+ currentPeriodStart: string;
1891
+ currentPeriodEnd: string;
1892
+ cancelAtPeriodEnd: boolean;
1893
+ canceledAt?: string;
1894
+ trialStart?: string;
1895
+ trialEnd?: string;
1896
+ seats: number;
1897
+ amount: number;
1898
+ currency: string;
1899
+ interval: BillingInterval;
1900
+ provider: PaymentProvider;
1901
+ providerSubscriptionId: string;
1902
+ licenseKeys: LicenseKey[];
1903
+ paymentMethod?: PaymentMethod;
1904
+ latestInvoice?: Invoice;
1905
+ }
1906
+
1907
+ declare interface SubscriptionInfo {
1908
+ id: string;
1909
+ status: 'active' | 'past_due' | 'canceled' | 'trialing' | 'paused';
1910
+ plan: string;
1911
+ tier: LicenseTier;
1912
+ pricePerMonth: number;
1913
+ pricePerYear: number;
1914
+ currency: string;
1915
+ currentPeriodStart: string;
1916
+ currentPeriodEnd: string;
1917
+ cancelAtPeriodEnd: boolean;
1918
+ seats: number;
1919
+ paymentMethod?: PaymentMethodInfo;
1920
+ }
1921
+
1922
+ declare type SubscriptionStatus = 'active' | 'past_due' | 'unpaid' | 'canceled' | 'incomplete' | 'trialing' | 'paused';
1923
+
1924
+ /** Available support channels */
1925
+ export declare type SupportChannel = 'email' | 'chat' | 'phone' | 'dedicated-manager' | 'on-site';
1926
+
1927
+ /** License telemetry event (opt-in) */
1928
+ export declare interface TelemetryEvent {
1929
+ /** Event type */
1930
+ type: 'activation' | 'deactivation' | 'feature_use' | 'validation' | 'error';
1931
+ /** License key (hashed) */
1932
+ licenseKeyHash: string;
1933
+ /** Timestamp */
1934
+ timestamp: string;
1935
+ /** Event data */
1936
+ data?: Record<string, unknown>;
1937
+ }
1938
+
1939
+ /**
1940
+ * Check if tier meets minimum requirement
1941
+ */
1942
+ export declare function tierMeetsRequirement(userTier: LicenseTier, requiredTier: LicenseTier): boolean;
1943
+
1944
+ /** Rate limit configuration for a single tier */
1945
+ export declare interface TierRateLimit {
1946
+ /** Maximum requests in the window */
1947
+ maxRequests: number;
1948
+ /** Window duration in ms */
1949
+ windowMs: number;
1950
+ /** Burst allowance (extra requests beyond max, refills over time) */
1951
+ burst?: number;
1952
+ }
1953
+
1954
+ declare type TimeRange = '24h' | '7d' | '30d' | '90d' | '1y' | 'all';
1955
+
1956
+ declare interface TimeSeriesDataPoint {
1957
+ timestamp: string;
1958
+ value: number;
1959
+ label?: string;
1960
+ }
1961
+
1962
+ export declare interface TransferConfig {
1963
+ apiBaseUrl: string;
1964
+ authToken?: string;
1965
+ /** Require admin approval for transfers */
1966
+ requireApproval?: boolean;
1967
+ /** Days before pending transfer expires */
1968
+ expirationDays?: number;
1969
+ /** Allow transfers to external organizations */
1970
+ allowExternalTransfers?: boolean;
1971
+ /** Notification settings */
1972
+ notifications?: {
1973
+ email: boolean;
1974
+ inApp: boolean;
1975
+ slack?: string;
1976
+ };
1977
+ onTransferComplete?: (transfer: TransferRequest) => void;
1978
+ onError?: (error: TransferError) => void;
1979
+ }
1980
+
1981
+ declare interface TransferError {
1982
+ code: string;
1983
+ message: string;
1984
+ }
1985
+
1986
+ declare interface TransferFormData {
1987
+ licenseKey: string;
1988
+ recipientEmail: string;
1989
+ recipientName: string;
1990
+ notes: string;
1991
+ transferReason: 'employee_change' | 'department_transfer' | 'organization_sale' | 'other';
1992
+ confirmDeactivation: boolean;
1993
+ }
1994
+
1995
+ declare interface TransferNotification {
1996
+ type: 'initiated' | 'pending_approval' | 'approved' | 'rejected' | 'completed' | 'reminder';
1997
+ sentAt: string;
1998
+ recipient: string;
1999
+ delivered: boolean;
2000
+ }
2001
+
2002
+ declare interface TransferParty {
2003
+ id: string;
2004
+ name: string;
2005
+ email: string;
2006
+ organizationId?: string;
2007
+ organizationName?: string;
2008
+ }
2009
+
2010
+ export declare interface TransferRequest {
2011
+ id: string;
2012
+ licenseKey: LicenseKey;
2013
+ license: LicenseInfo;
2014
+ fromOrganization: TransferParty;
2015
+ toOrganization: TransferParty;
2016
+ status: TransferStatus;
2017
+ createdAt: string;
2018
+ updatedAt: string;
2019
+ expiresAt: string;
2020
+ notes?: string;
2021
+ approvalRequired: boolean;
2022
+ approvedBy?: string;
2023
+ approvedAt?: string;
2024
+ rejectionReason?: string;
2025
+ transferToken?: string;
2026
+ notificationsSent: TransferNotification[];
2027
+ }
2028
+
2029
+ export declare type TransferStatus = 'pending' | 'pending_approval' | 'approved' | 'rejected' | 'completed' | 'cancelled' | 'expired';
2030
+
2031
+ /** Transfer Status Badge */
2032
+ export declare const TransferStatusBadge: default_2.FC<{
2033
+ status: TransferStatus;
2034
+ }>;
2035
+
2036
+ declare type TransferStep = 'select-license' | 'enter-recipient' | 'review' | 'confirmation' | 'processing' | 'complete';
2037
+
2038
+ declare interface TrendData {
2039
+ metric: string;
2040
+ current: number;
2041
+ previous: number;
2042
+ change: number;
2043
+ changePercent: number;
2044
+ trend: 'up' | 'down' | 'stable';
2045
+ }
2046
+
2047
+ /** Main Dashboard Component */
2048
+ export declare const UsageAnalyticsDashboard: default_2.FC<UsageAnalyticsDashboardProps>;
2049
+
2050
+ declare interface UsageAnalyticsDashboardProps extends AnalyticsConfig {
2051
+ className?: string;
2052
+ style?: default_2.CSSProperties;
2053
+ }
2054
+
2055
+ export declare class UsageAnalyticsService {
2056
+ private config;
2057
+ constructor(config: AnalyticsConfig);
2058
+ private request;
2059
+ private getTimeParams;
2060
+ /** Get overview metrics */
2061
+ getOverview(range?: TimeRange): Promise<OverviewMetrics>;
2062
+ /** Get license activity over time */
2063
+ getLicenseActivity(range?: TimeRange, granularity?: MetricGranularity): Promise<TimeSeriesDataPoint[]>;
2064
+ /** Get user activity over time */
2065
+ getUserActivity(range?: TimeRange, granularity?: MetricGranularity): Promise<TimeSeriesDataPoint[]>;
2066
+ /** Get feature usage data */
2067
+ getFeatureUsage(range?: TimeRange, features?: FeatureId[]): Promise<FeatureUsageData[]>;
2068
+ /** Get top users by activity */
2069
+ getTopUsers(range?: TimeRange, limit?: number): Promise<UserActivityData[]>;
2070
+ /** Get license utilization */
2071
+ getLicenseUtilization(): Promise<LicenseUtilizationData[]>;
2072
+ /** Get geographic distribution */
2073
+ getGeographicData(range?: TimeRange): Promise<GeographicData[]>;
2074
+ /** Get trends for key metrics */
2075
+ getTrends(range?: TimeRange): Promise<TrendData[]>;
2076
+ /** Get retention cohorts */
2077
+ getRetentionCohorts(months?: number): Promise<CohortData[]>;
2078
+ /** Export analytics data */
2079
+ exportData(range: TimeRange, format: 'csv' | 'json' | 'xlsx'): Promise<Blob>;
2080
+ }
2081
+
2082
+ declare interface UsageRecord {
2083
+ subscriptionId: string;
2084
+ metricId: string;
2085
+ quantity: number;
2086
+ recordedAt: string;
2087
+ }
2088
+
2089
+ /**
2090
+ * Usage Telemetry Service
2091
+ */
2092
+ export declare class UsageTelemetry {
2093
+ private config;
2094
+ private queue;
2095
+ private flushTimer;
2096
+ private _active;
2097
+ constructor(config: UsageTelemetryConfig);
2098
+ /** Start collecting telemetry (no-op if disabled or DNT) */
2099
+ start(): void;
2100
+ /** Stop collecting and flush remaining events */
2101
+ stop(): Promise<void>;
2102
+ /** Track a telemetry event */
2103
+ track(type: TelemetryEvent['type'], data?: Record<string, unknown>): void;
2104
+ /** Track feature usage */
2105
+ trackFeatureUse(featureId: string): void;
2106
+ /** Track activation event */
2107
+ trackActivation(): void;
2108
+ /** Track deactivation event */
2109
+ trackDeactivation(): void;
2110
+ /** Track validation event */
2111
+ trackValidation(valid: boolean): void;
2112
+ /** Track error event */
2113
+ trackError(errorCode: string): void;
2114
+ /** Get queued event count */
2115
+ get queueSize(): number;
2116
+ /** Check if telemetry is active */
2117
+ get active(): boolean;
2118
+ /** Flush queued events to server */
2119
+ flush(): Promise<void>;
2120
+ /** Enable telemetry (opt-in) */
2121
+ enable(): void;
2122
+ /** Disable telemetry (opt-out) */
2123
+ disable(): void;
2124
+ /** Check if telemetry is allowed */
2125
+ private isAllowed;
2126
+ }
2127
+
2128
+ /** Telemetry configuration */
2129
+ export declare interface UsageTelemetryConfig {
2130
+ /** Endpoint URL for sending telemetry */
2131
+ endpoint: string;
2132
+ /** API key for authentication */
2133
+ apiKey?: string;
2134
+ /** Hashed license key (never store raw key) */
2135
+ licenseKeyHash: string;
2136
+ /** Whether telemetry is enabled (default: false — opt-in) */
2137
+ enabled?: boolean;
2138
+ /** Batch size — events are sent when batch reaches this size (default: 20) */
2139
+ batchSize?: number;
2140
+ /** Flush interval in ms (default: 60000 — 1 minute) */
2141
+ flushInterval?: number;
2142
+ /** Max queue size — oldest events are dropped when exceeded (default: 500) */
2143
+ maxQueueSize?: number;
2144
+ /** Respect browser Do-Not-Track header (default: true) */
2145
+ respectDNT?: boolean;
2146
+ }
2147
+
2148
+ export declare function useActivationWizard(config: ActivationWizardConfig): {
2149
+ state: ActivationState;
2150
+ setLicenseKey: (key: string) => void;
2151
+ setMachineName: (name: string) => void;
2152
+ setTermsAccepted: (accepted: boolean) => void;
2153
+ validateKey: () => Promise<void>;
2154
+ acceptTermsAndActivate: () => Promise<void>;
2155
+ startOfflineActivation: () => Promise<void>;
2156
+ submitOfflineResponse: (response: string) => Promise<void>;
2157
+ reset: () => void;
2158
+ goBack: () => void;
2159
+ };
2160
+
2161
+ export declare function useLicensePortal(config: LicensePortalConfig): {
2162
+ state: LicensePortalState;
2163
+ service: LicensePortalService;
2164
+ loadData: () => Promise<void>;
2165
+ activateLicense: (licenseKey: LicenseKey, machineId: string, machineName?: string) => Promise<LicenseInfo>;
2166
+ deactivateLicense: (licenseKey: LicenseKey, machineId: string) => Promise<void>;
2167
+ transferLicense: (licenseKey: LicenseKey, targetEmail: string, notes?: string) => Promise<{
2168
+ transferId: string;
2169
+ status: string;
2170
+ }>;
2171
+ selectLicense: (license: LicenseInfo | null) => void;
2172
+ setActiveTab: (tab: LicensePortalState["activeTab"]) => void;
2173
+ };
2174
+
2175
+ export declare function useLicenseTransfer(config: TransferConfig): {
2176
+ step: TransferStep;
2177
+ setStep: default_2.Dispatch<default_2.SetStateAction<TransferStep>>;
2178
+ licenses: LicenseInfo[];
2179
+ formData: TransferFormData;
2180
+ setFormData: default_2.Dispatch<default_2.SetStateAction<TransferFormData>>;
2181
+ selectedLicense: LicenseInfo | null;
2182
+ recipientValidation: {
2183
+ valid: boolean;
2184
+ isExternal: boolean;
2185
+ warnings?: string[];
2186
+ } | null;
2187
+ transfer: TransferRequest | null;
2188
+ loading: boolean;
2189
+ error: TransferError | null;
2190
+ loadLicenses: () => Promise<void>;
2191
+ selectLicense: (license: LicenseInfo) => void;
2192
+ validateRecipient: () => Promise<void>;
2193
+ proceedToReview: () => void;
2194
+ initiateTransfer: () => Promise<void>;
2195
+ reset: () => void;
2196
+ };
2197
+
2198
+ export declare interface UserActivityData {
2199
+ userId: string;
2200
+ email: string;
2201
+ displayName?: string;
2202
+ licenseKey: string;
2203
+ tier: LicenseTier;
2204
+ lastActive: string;
2205
+ sessionCount: number;
2206
+ totalDuration: number;
2207
+ featuresUsed: number;
2208
+ topFeatures: {
2209
+ featureId: string;
2210
+ uses: number;
2211
+ }[];
2212
+ }
2213
+
2214
+ export declare function useUsageAnalytics(config: AnalyticsConfig): {
2215
+ state: AnalyticsState;
2216
+ setTimeRange: (range: TimeRange) => void;
2217
+ refresh: (range?: TimeRange) => Promise<void>;
2218
+ exportData: (format: "csv" | "json" | "xlsx") => Promise<void>;
2219
+ };
2220
+
2221
+ /**
2222
+ * Validate license key format and checksum
2223
+ */
2224
+ export declare function validateKeyFormat(key: LicenseKey): boolean;
2225
+
2226
+ /**
2227
+ * Validate license key (convenience function)
2228
+ */
2229
+ export declare function validateLicense(key: LicenseKey): Promise<LicenseValidationResult>;
2230
+
2231
+ export declare const VERSION = "1.1.0";
2232
+
2233
+ /** White-label brand configuration */
2234
+ export declare interface WhiteLabelConfig {
2235
+ /** Custom product name */
2236
+ productName?: string;
2237
+ /** Logo URL (light theme) */
2238
+ logoUrl?: string;
2239
+ /** Logo URL (dark theme) */
2240
+ logoDarkUrl?: string;
2241
+ /** Favicon URL */
2242
+ faviconUrl?: string;
2243
+ /** Primary brand color (hex) */
2244
+ primaryColor?: string;
2245
+ /** Secondary brand color (hex) */
2246
+ secondaryColor?: string;
2247
+ /** Accent color (hex) */
2248
+ accentColor?: string;
2249
+ /** Custom CSS to inject */
2250
+ customCss?: string;
2251
+ /** Custom footer text */
2252
+ footerText?: string;
2253
+ /** Hide "Powered by Nice2Dev" badge */
2254
+ hidePoweredBy?: boolean;
2255
+ /** Custom domain for white-labeled deployment */
2256
+ customDomain?: string;
2257
+ /** Custom email sender domain */
2258
+ emailDomain?: string;
2259
+ }
2260
+
2261
+ /**
2262
+ * White-label manager — applies brand overrides based on license tier
2263
+ */
2264
+ export declare class WhiteLabelManager {
2265
+ private config;
2266
+ private currentTier;
2267
+ /** Set the active license tier */
2268
+ setTier(tier: LicenseTier): void;
2269
+ /** Update white-label configuration (only applicable fields per tier are kept) */
2270
+ setConfig(config: WhiteLabelConfig): void;
2271
+ /** Get the resolved configuration (filtered by tier permissions) */
2272
+ getResolvedConfig(): Partial<WhiteLabelConfig>;
2273
+ /** Check if a specific white-label feature is allowed */
2274
+ isFeatureAllowed(feature: keyof WhiteLabelConfig): boolean;
2275
+ /** Get list of features not available at current tier */
2276
+ getLockedFeatures(): (keyof WhiteLabelConfig)[];
2277
+ /** Get list of features available at current tier */
2278
+ getUnlockedFeatures(): (keyof WhiteLabelConfig)[];
2279
+ /** Generate CSS custom properties from the resolved config */
2280
+ generateCssVariables(): string;
2281
+ /** Apply the brand configuration to the document */
2282
+ applyToDocument(): void;
2283
+ }
2284
+
2285
+ export { }