Implement versions 0.0.4-0.0.7 features

v0.0.4:
- Add WooCommerce settings tab for default license settings
- Per-product settings override global defaults

v0.0.5:
- Add bulk license operations (activate, deactivate, revoke, extend, delete)
- Add license renewal/extension and lifetime functionality
- Add quick action buttons per license row

v0.0.6:
- Add license dashboard with statistics and analytics
- Add license transfer functionality (admin)
- Add CSV export for licenses
- Add OpenAPI 3.1 specification
- Remove /deactivate API endpoint

v0.0.7:
- Move license dashboard to WooCommerce Reports section
- Add license search and filtering in admin
- Add customer-facing license transfer with AJAX modal
- Add email notifications for license expiration warnings
- Add bulk import licenses from CSV
- Update README with comprehensive documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-21 20:32:35 +01:00
parent 78e43b9aea
commit 49a0699963
21 changed files with 4132 additions and 289 deletions

133
CLAUDE.md
View File

@@ -36,11 +36,9 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w
_No known bugs at this time._
### Version 0.0.4 (Next)
### Version 0.0.8 (Next)
- Consider adding license usage statistics/analytics
- Consider adding bulk license operations in admin
- Consider adding license renewal/extension functionality
_No planned features yet. Add items as needed._
## Technical Stack
@@ -225,12 +223,13 @@ Created on plugin activation via `Installer::createTables()`:
Base: `/wp-json/wc-licensed-product/v1/`
| Endpoint | Method | Description |
| -------------- | ------ | -------------------------------- |
| `/validate` | POST | Validate license key for domain |
| `/status` | POST | Get license status |
| `/activate` | POST | Activate license on domain |
| `/deactivate` | POST | Deactivate license |
| Endpoint | Method | Description |
| ----------- | ------ | ------------------------------- |
| `/validate` | POST | Validate license key for domain |
| `/status` | POST | Get license status |
| `/activate` | POST | Activate license on domain |
Full API documentation available in `openapi.json` (OpenAPI 3.1 specification).
### Key Classes
@@ -316,3 +315,117 @@ Base: `/wp-json/wc-licensed-product/v1/`
**Bug fixes:**
- Fixed product versions meta box visibility for non-licensed product types (targets `#wc_licensed_product_versions` container)
### 2026-01-21 - Version 0.0.4 Features
**Implemented:**
- WooCommerce settings tab "Licensed Products" for default license settings
- Default settings for Max Activations, License Validity, and Bind to Major Version
- Per-product settings override global defaults (empty = use default)
- Settings link in product edit page pointing to WooCommerce settings
**New classes:**
- `SettingsController` - WooCommerce settings tab integration
**Technical notes:**
- Settings stored using WooCommerce options API
- LicensedProduct model falls back to global defaults when product settings are empty
- Added `has_custom_*` methods to check if product has overridden defaults
- Product edit panel shows placeholders with default values
### 2026-01-21 - Version 0.0.5 Features
**Implemented:**
- Bulk license operations in admin (activate, deactivate, revoke, extend, delete)
- License renewal/extension functionality (extend by 30/90/365 days)
- Set license to lifetime (remove expiration)
- Quick action buttons per license row (+30d, ∞, Revoke, Delete)
- Checkbox selection with select-all for bulk operations
- Improved admin notices for bulk operation results
**New methods in LicenseManager:**
- `extendLicense()` - Extend license by specified days
- `setLicenseLifetime()` - Remove expiration (set to lifetime)
- `bulkUpdateStatus()` - Bulk update license status
- `bulkDelete()` - Bulk delete licenses
- `bulkExtend()` - Bulk extend licenses
**Technical notes:**
- Admin page redesigned with WordPress list table styling
- Twig template functions for generating action URLs with nonces
- JavaScript for checkbox synchronization and bulk action handling
- Row-actions pattern for cleaner per-license action UI
### 2026-01-21 - Version 0.0.6 Features
**Implemented:**
- License usage statistics/analytics dashboard (WooCommerce > License Dashboard)
- License transfer functionality (change domain from admin)
- Export licenses to CSV with all related data
- OpenAPI 3.1 specification for REST API (`openapi.json`)
- Removed `/deactivate` API endpoint (admin-only operation now)
**New methods in LicenseManager:**
- `transferLicense()` - Transfer license to new domain
- `getStatistics()` - Get comprehensive license statistics
- `exportLicensesForCsv()` - Export all licenses for CSV download
**New files:**
- `templates/admin/dashboard.html.twig` - Dashboard template
- `openapi.json` - OpenAPI 3.1 specification
**Technical notes:**
- Dashboard shows status cards, monthly chart, top products/domains
- Transfer uses modal dialog with form submission
- CSV export includes BOM for UTF-8 Excel compatibility
- OpenAPI spec documents all endpoints with examples and error responses
- Statistics query uses SQL aggregation for performance
### 2026-01-21 - Version 0.0.7 Features
**Implemented:**
- License Dashboard moved to WooCommerce Reports section (Reports > Licenses tab)
- License search and filtering in admin (by key, domain, status, product)
- Customer-facing license transfer request with AJAX modal
- Email notifications for license expiration warnings (7 days and 1 day before)
- Bulk import licenses from CSV with validation and options
**New methods in LicenseManager:**
- `getLicensesExpiringSoon()` - Get licenses expiring within specified days
- `markExpirationNotified()` - Track expiration notification state
- `wasExpirationNotified()` - Check if notification already sent
- `importLicense()` - Create license from imported data
**Updated controllers:**
- `AdminController` - Added Reports integration, search/filter handling, CSV import
- `AccountController` - Added customer transfer AJAX handler with domain validation
- `LicenseEmailController` - Added cron scheduling and expiration warning emails
- `Installer` - Clears cron events on deactivation
**New UI features:**
- Search box and filter dropdowns on licenses page
- Transfer button and modal on customer licenses page
- Import CSV page with format documentation
- Pagination preserves filter state
**Technical notes:**
- WooCommerce Reports integration uses `woocommerce_admin_reports` filter
- Customer transfer uses AJAX with nonce verification
- Expiration warnings use WordPress cron with daily schedule
- CSV import supports both exported format and simplified format
- User meta tracks expiration notifications to prevent duplicates