# Claritee Publisher - TODO

## Phase 1: WordPress Plugin ✅ COMPLETED

- [x] Create plugin skeleton with main file and folder structure
- [x] Implement REST API endpoint for receiving Claritee data
- [x] Add page creation logic with Elementor metadata
- [x] Implement image sideloading and URL replacement
- [x] Add API Key authentication system
- [x] Create API Key management service
- [x] Create WordPress admin settings page for API Keys
- [x] Add error handling and validation
- [x] Create README documentation

## Phase 2: Testing & QA

### Local Testing
- [ ] Test plugin installation on fresh WordPress
- [ ] Test plugin activation/deactivation
- [ ] Test API key generation in admin
- [ ] Test API key revocation and deletion
- [ ] Test health check endpoint without auth

### Elementor Integration Testing
- [ ] Test with Elementor Free
- [ ] Test with Elementor Pro
- [ ] Verify page creation with basic elements
- [ ] Test responsive breakpoints preservation
- [ ] Test custom fonts and colors
- [ ] Verify canvas template application

### API Endpoint Testing
- [ ] Test publish endpoint with valid API key
- [ ] Test publish endpoint with invalid API key
- [ ] Test publish endpoint with revoked API key
- [ ] Test publish endpoint without API key
- [ ] Test with missing required fields (title, content_data)
- [ ] Test with duplicate page slug
- [ ] Test with different post statuses (draft, publish, private, pending)

### Image Import Testing
- [ ] Test single image import
- [ ] Test multiple images import
- [ ] Test with invalid image URLs
- [ ] Test with inaccessible images
- [ ] Test with very large images
- [ ] Verify alt text is preserved
- [ ] Verify images attached to correct post
- [ ] Test URL replacement in Elementor JSON

### Authentication Testing
- [ ] Test with X-Claritee-API-Key header
- [ ] Test with Authorization Bearer token
- [ ] Test with user lacking publish_pages capability
- [ ] Test usage count increments
- [ ] Test last_used timestamp updates

### Error Scenarios
- [ ] Test with malformed JSON
- [ ] Test with Elementor not installed
- [ ] Test with outdated Elementor version
- [ ] Test with network timeout during image download
- [ ] Test with WordPress upload limit exceeded
- [ ] Test with invalid page_builder parameter

## Phase 3: Optimization & Polish

### Performance
- [ ] Add caching for builder availability checks
- [ ] Optimize image download for large batches
- [ ] Add batch import support (multiple pages at once)
- [ ] Implement async image processing with background jobs

### Security Enhancements
- [ ] Add rate limiting per API key
- [ ] Add IP whitelist option for API keys
- [ ] Add webhook signature verification option
- [ ] Implement API key expiration dates
- [ ] Add audit log for all publish actions

### Admin UI Improvements
- [ ] Add statistics dashboard (total pages published, images imported)
- [ ] Add recent activity log
- [ ] Add filtering/search for API keys
- [ ] Add bulk operations for keys
- [ ] Add key usage alerts/notifications
- [ ] Show Elementor installation status on admin page

### Developer Experience
- [ ] Add WP-CLI commands for key management
- [ ] Add debugging mode with detailed logs
- [ ] Create example Elementor JSON structures
- [ ] Add PHPUnit tests
- [ ] Add integration tests

## Phase 4: Additional Page Builders

### Bricks Builder
- [ ] Create BricksBuilder class implementing PageBuilderInterface
- [ ] Test page creation with Bricks
- [ ] Test image import with Bricks
- [ ] Document Bricks-specific JSON structure

### Gutenberg (Block Editor)
- [ ] Create GutenbergBuilder class
- [ ] Convert Claritee design to Gutenberg blocks
- [ ] Test with core blocks
- [ ] Test with popular block plugins (Kadence, GenerateBlocks)

### Divi Builder
- [ ] Create DiviBuilder class
- [ ] Test Divi modules creation
- [ ] Test Divi responsive settings

### Oxygen Builder
- [ ] Create OxygenBuilder class
- [ ] Test Oxygen component creation

### Beaver Builder
- [ ] Create BeaverBuilder class
- [ ] Test Beaver modules

## Phase 5: Advanced Features

### Content Management
- [ ] Add update existing page functionality (instead of only create)
- [ ] Add page templates support
- [ ] Add custom post type support (not just pages)
- [ ] Add revision history integration
- [ ] Add draft auto-save functionality

### Collaboration Features
- [ ] Add multi-user API key support
- [ ] Add role-based permissions for API keys
- [ ] Add notification system for new publishes
- [ ] Add approval workflow option

### Integration Features
- [ ] Add webhook for post-publish events
- [ ] Add integration with popular SEO plugins (Yoast, Rank Math)
- [ ] Add integration with caching plugins (WP Rocket, W3 Total Cache)
- [ ] Add integration with translation plugins (WPML, Polylang)

### Analytics & Monitoring
- [ ] Add detailed analytics dashboard
- [ ] Add performance metrics (import time, image processing time)
- [ ] Add error tracking and reporting
- [ ] Add usage reports per API key

## Phase 6: Documentation & Distribution

### Documentation
- [ ] Create video tutorial for setup
- [ ] Create developer documentation
- [ ] Add inline code documentation (PHPDoc)
- [ ] Create troubleshooting guide with common issues
- [ ] Create FAQ section

### Distribution
- [ ] Prepare plugin for WordPress.org submission
- [ ] Create plugin banner and icon
- [ ] Create screenshots for WordPress.org
- [ ] Set up GitHub releases
- [ ] Create changelog format for updates

### Support Infrastructure
- [ ] Set up support ticket system
- [ ] Create community forum
- [ ] Create knowledge base
- [ ] Set up automated email responses

## Phase 7: Claritee Frontend Integration

### Connection UI
- [ ] Create WordPress integration settings page in Claritee
- [ ] Add site URL input field
- [ ] Add API key input field
- [ ] Add "Test Connection" button
- [ ] Show connection status indicator
- [ ] Store multiple WordPress sites per workspace

### Publish Flow
- [ ] Add "Publish to WordPress" button in design editor
- [ ] Create publish modal with options:
  - [ ] Select target WordPress site
  - [ ] Enter page title
  - [ ] Generate/edit slug
  - [ ] Choose status (draft/publish)
  - [ ] Select page builder
- [ ] Show progress indicator during publish
- [ ] Handle API errors gracefully with user-friendly messages
- [ ] Show success dialog with links (View Page, Edit in Elementor)

### Export Logic
- [ ] Convert Claritee design to Elementor JSON format
- [ ] Map Claritee components to Elementor widgets
- [ ] Convert responsive breakpoints
- [ ] Export all design assets (images, fonts)
- [ ] Handle custom CSS/JS if any

### History & Management
- [ ] Add "Published Pages" section in Claritee
- [ ] Show list of published pages with metadata
- [ ] Add "Republish" functionality (update existing page)
- [ ] Add "View in WordPress" quick links

## Known Issues / Bugs to Fix

- [ ] None yet - add issues as they're discovered

## Feature Requests

- [ ] None yet - add requests from users

## Notes

### Priority Legend
- 🔴 High Priority - Blocking or critical
- 🟡 Medium Priority - Important but not blocking
- 🟢 Low Priority - Nice to have

### Testing Environments Needed
- WordPress 5.8 (minimum version)
- WordPress 6.4 (latest)
- PHP 7.4 (minimum version)
- PHP 8.2 (latest)
- Elementor 3.0 (minimum version)
- Elementor 3.18+ (latest)

### Browser Testing (for admin UI)
- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Edge

---

**Last Updated:** 2025-01-06
**Current Phase:** Phase 1 Complete ✅ → Moving to Phase 2 (Testing)
