style: implement custom color schemes and gradients for account section, enhancing visual hierarchy
554 lines
19 KiB
Markdown
554 lines
19 KiB
Markdown
# IGNY8 Change Log
|
|
|
|
**Current Version:** v1.0.1
|
|
**Last Updated:** December 12, 2025
|
|
|
|
---
|
|
|
|
## v1.0.1 - December 12, 2025
|
|
|
|
### Fixed
|
|
- Usage summary endpoint routing - added direct URL path for `/api/v1/billing/usage-summary/` as standalone user-facing endpoint (separated from admin-only `BillingViewSet`)
|
|
- Endpoint accessibility issue - properly registered `get_usage_summary` function view in billing URLs
|
|
|
|
### Added
|
|
- **Frontend Plan Limits Display**: Complete UI integration for usage tracking and limits
|
|
- `UsageLimitsPanel` component - visual progress bars for all plan limits with color-coded status (blue/yellow/red)
|
|
- Plan Limits tab in Usage Analytics page (now default/first tab)
|
|
- Limit display in pricing table comparison with "Unlimited" formatting for high values
|
|
- Days until reset counter for monthly limits
|
|
- Upgrade CTA when approaching limits
|
|
|
|
- **IGNY8 Brand Styling**: Custom CSS design system for account section (`account-colors.css`)
|
|
- Brand gradients (primary blue, success green, warning amber, danger red, purple, teal)
|
|
- Enhanced card variants with top color bars
|
|
- Animated progress bars with shimmer effects
|
|
- Stat numbers with gradient text effects
|
|
- Custom badges and plan cards
|
|
- Billing tables with hover effects
|
|
- Dark mode support throughout
|
|
|
|
### Changed
|
|
- Usage Analytics page tab order - Plan Limits now first tab, followed by Credit Usage, Credit Balance, API Usage, Cost Breakdown
|
|
- Pricing table enhanced to display all plan limits (sites, users, words/month, ideas/month, images/month, credits/month)
|
|
- Plans and Billing page now passes complete limit data to pricing table component
|
|
|
|
### Documentation
|
|
- Added API endpoint rules to `.cursorrules` - enforce using existing `/api/v1/` structure, test via `/api/docs/` Swagger, no parallel API systems
|
|
- Updated `PLAN-LIMITS.md` with correct endpoint path documentation
|
|
|
|
---
|
|
|
|
## v1.0.0 - December 12, 2025 (Production Release)
|
|
|
|
### 🎉 INITIAL PRODUCTION RELEASE
|
|
|
|
This marks the first production-ready release of IGNY8, featuring a complete multi-tenant AI-powered content platform.
|
|
|
|
### 🆕 Latest Additions (v1.0.0 Final)
|
|
|
|
**Plan Limits System** - Implemented comprehensive usage limits tied to subscription plans:
|
|
- **Hard Limits** (persistent, never reset):
|
|
- `max_sites`: Maximum number of sites per account
|
|
- `max_users`: Maximum team members
|
|
- `max_keywords`: Total keywords allowed
|
|
- `max_clusters`: Total clusters allowed
|
|
|
|
- **Monthly Limits** (reset on billing cycle):
|
|
- `max_content_ideas`: New content ideas per month
|
|
- `max_content_words`: Words generated per month
|
|
- `max_images_basic`: Basic AI images per month
|
|
- `max_images_premium`: Premium AI images per month
|
|
- `max_image_prompts`: Image prompts per month
|
|
|
|
- **Enforcement Features**:
|
|
- Pre-operation validation (blocks exceeding actions)
|
|
- Real-time usage tracking and incrementation
|
|
- Automatic monthly reset via Celery Beat task
|
|
- Usage summary API endpoint (`/api/v1/billing/usage-summary/`)
|
|
- Warning notifications at 80% threshold
|
|
- Clear error messages with upgrade prompts
|
|
|
|
- **Technical Implementation**:
|
|
- `PlanLimitUsage` model tracks monthly consumption
|
|
- `LimitService` handles all check/increment/reset operations
|
|
- `word_counter.py` utility for accurate HTML word counting
|
|
- Integrated into Site creation, content generation, image generation
|
|
- Celery scheduled tasks: `reset_monthly_plan_limits` (daily), `check_approaching_limits` (daily)
|
|
|
|
|
|
### ✨ Core Features Implemented
|
|
|
|
**Multi-Tenancy System:**
|
|
- Complete account isolation with row-level security
|
|
- Multi-site management per account
|
|
- Sector-based content organization
|
|
- Role-based access control (Owner, Admin, Editor, Viewer)
|
|
- Session management with Redis backend
|
|
- JWT authentication with refresh tokens
|
|
|
|
**Planner Module:**
|
|
- Bulk keyword import (CSV, unlimited rows)
|
|
- AI-powered keyword clustering (GPT-4)
|
|
- Global seed keyword database (50+ industries)
|
|
- Content idea generation from clusters
|
|
- Search intent classification
|
|
- Advanced filtering and search
|
|
|
|
**Writer Module:**
|
|
- AI content generation (GPT-4, customizable word counts)
|
|
- Task management and queuing
|
|
- Content taxonomy system (categories, tags)
|
|
- HTML content editor integration
|
|
- SEO metadata management
|
|
- Status workflow (draft, review, published)
|
|
|
|
**Image Generation:**
|
|
- Dual AI providers (DALL-E 3, Runware)
|
|
- Featured and in-article images
|
|
- Smart prompt extraction from content
|
|
- Multiple image sizes and formats
|
|
- Automatic alt text generation
|
|
- Batch image processing
|
|
|
|
**Automation Pipeline:**
|
|
- 7-stage automation (keywords → clusters → ideas → tasks → content → prompts → images)
|
|
- Scheduled runs (daily, weekly, monthly)
|
|
- Configurable batch sizes and delays
|
|
- Credit estimation and buffering
|
|
- Pause/resume functionality
|
|
- Detailed activity logging
|
|
|
|
**Internal Linking:**
|
|
- AI-powered link candidate discovery
|
|
- Relevance scoring and smart injection
|
|
- Context-aware anchor text
|
|
- Bi-directional linking
|
|
- Link density control
|
|
|
|
**Content Optimization:**
|
|
- 15+ factor SEO analysis
|
|
- Readability scoring
|
|
- AI-powered content enhancement
|
|
- Before/after comparison
|
|
- Batch optimization support
|
|
|
|
**WordPress Integration:**
|
|
- One-click publishing to WordPress
|
|
- Bidirectional status sync
|
|
- Taxonomy synchronization
|
|
- Featured image upload
|
|
- SEO metadata sync
|
|
- Multiple site support
|
|
- API key authentication
|
|
|
|
**Billing & Credits:**
|
|
- Usage-based credit system
|
|
- Plan-based hard limits (sites, users, keywords, clusters)
|
|
- Monthly usage limits (content ideas, words, images, prompts)
|
|
- Automatic limit enforcement with clear error messages
|
|
- Real-time usage tracking and reporting
|
|
- Monthly limit reset on billing cycle
|
|
- Usage warning notifications
|
|
- Multiple payment methods (Bank Transfer, Mobile Wallet, Stripe*, PayPal*)
|
|
- Invoice generation and management
|
|
- Credit transaction tracking
|
|
- Multi-currency support (8 currencies)
|
|
- Manual payment approval workflow
|
|
|
|
**Enterprise Features:**
|
|
- Team collaboration and user management
|
|
- Activity logging and audit trails
|
|
- API access with rate limiting
|
|
- Comprehensive analytics and reporting
|
|
- Data export capabilities
|
|
|
|
### 🏗️ Technical Stack
|
|
|
|
**Backend:**
|
|
- Django 5.x + Django REST Framework
|
|
- PostgreSQL 14+ (production)
|
|
- Redis 7+ (cache and sessions)
|
|
- Celery + Celery Beat (task queue)
|
|
- JWT authentication
|
|
- Docker containerization
|
|
|
|
**Frontend:**
|
|
- React 19 + TypeScript
|
|
- Vite 6 (build tool)
|
|
- Zustand 5 (state management)
|
|
- TailwindCSS 4 (styling)
|
|
- React Router 7 (routing)
|
|
- Custom component library
|
|
|
|
**AI Integration:**
|
|
- OpenAI GPT-4, GPT-4 Turbo, GPT-3.5 Turbo
|
|
- OpenAI DALL-E 3, DALL-E 2
|
|
- Runware image generation
|
|
|
|
### 📊 Platform Statistics
|
|
|
|
- 50+ backend API endpoints
|
|
- 100+ React components
|
|
- 15+ database models
|
|
- 20+ Celery tasks
|
|
- Support for 8 currencies
|
|
- 50+ industry templates
|
|
|
|
### 🔒 Security & Compliance
|
|
|
|
- Encrypted data at rest and in transit
|
|
- GDPR compliance ready
|
|
- Session integrity validation
|
|
- CORS and CSRF protection
|
|
- SQL injection prevention
|
|
- Rate limiting per scope
|
|
|
|
### 📚 Documentation
|
|
|
|
- Complete API documentation (OpenAPI 3.0)
|
|
- Frontend component library docs
|
|
- Admin guides and workflows
|
|
- Multi-tenancy architecture docs
|
|
- Payment workflow guides
|
|
|
|
### ⚠️ Known Limitations
|
|
|
|
- Stripe integration disabled (pending production credentials)
|
|
- PayPal integration disabled (pending production credentials)
|
|
- Some analytics features in development
|
|
|
|
---
|
|
|
|
## Tenancy Change Log - December 9, 2025
|
|
|
|
## Summary
|
|
This document tracks all changes made to the multi-tenancy system during the current staging session and the last 2 commits (4d13a570 and 72d0b6b0).
|
|
|
|
---
|
|
|
|
## 🔥 Critical Fixes - December 9, 2025
|
|
|
|
### Fixed
|
|
- User swapping/logout issue - Redis sessions, no-cache auth backend, session integrity checks
|
|
- useNavigate/useLocation HMR errors - Single Suspense boundary for Routes
|
|
|
|
### Added
|
|
- Custom `NoCacheModelBackend` authentication backend to prevent user object caching
|
|
- Session integrity validation in middleware (stores/verifies account_id and user_id per request)
|
|
|
|
### Changed
|
|
- Session storage from database to Redis cache (`SESSION_ENGINE = 'django.contrib.sessions.backends.cache'`)
|
|
- React Router Suspense from per-route to single top-level boundary
|
|
|
|
---
|
|
|
|
## 🔧 Recent Session Changes (Uncommitted)
|
|
|
|
### 1. Authentication & Signup Flow
|
|
**Fixed: JWT Token Generation in Registration**
|
|
- **Issue**: Users were immediately logged out after signup because tokens weren't being returned
|
|
- **Root Cause**: Two separate `register` endpoints existed - one in `AuthViewSet` (unused) and one in `RegisterView` (actual endpoint)
|
|
- **Fix**: Updated `RegisterView` in `backend/igny8_core/auth/urls.py` to generate and return JWT tokens
|
|
```python
|
|
# Added token generation to RegisterView
|
|
access_token = generate_access_token(user, account)
|
|
refresh_token = generate_refresh_token(user, account)
|
|
# Return tokens in response data
|
|
```
|
|
- **Files Changed**: `backend/igny8_core/auth/urls.py`
|
|
- **Impact**: Users now stay logged in after successful registration
|
|
|
|
**Enhanced: Frontend Token Extraction**
|
|
- **Issue**: Frontend couldn't parse tokens from backend response structure
|
|
- **Fix**: Added multiple fallback paths in `authStore.ts` to handle nested response structure
|
|
```typescript
|
|
// Handle both data.tokens.access and data.data.tokens.access
|
|
const newToken = tokens.access || responseData.access || data.data?.tokens?.access
|
|
```
|
|
- **Files Changed**: `frontend/src/store/authStore.ts`
|
|
|
|
### 2. Payment Confirmation Modal
|
|
**Fixed: Invoice Amount Display**
|
|
- **Issue**: Amount showing as "PKR 0.00" in payment confirmation modal
|
|
- **Root Cause**: Frontend expected `total` field but backend returned `total_amount`
|
|
- **Fix**: Updated invoice API to return both fields for compatibility
|
|
```python
|
|
'total': str(invoice.total), # Alias for compatibility
|
|
'total_amount': str(invoice.total),
|
|
```
|
|
- **Files Changed**:
|
|
- `backend/igny8_core/business/billing/views.py`
|
|
- `frontend/src/components/billing/PaymentConfirmationModal.tsx`
|
|
- `frontend/src/components/billing/PendingPaymentBanner.tsx`
|
|
|
|
### 3. Payment Approval Workflow
|
|
**Fixed: Manual Status Change Not Triggering Account Activation**
|
|
- **Issue**: When admin changed payment status to "succeeded" in Django admin, it didn't activate account or add credits
|
|
- **Root Cause**: `save_model()` only set `approved_by` but didn't run the full approval workflow
|
|
- **Fix**: Enhanced `save_model()` in `PaymentAdmin` to trigger complete workflow:
|
|
- Update invoice status to 'paid'
|
|
- Activate subscription status to 'active'
|
|
- Activate account status to 'active'
|
|
- Add credits based on plan
|
|
- Prevent duplicate credit transactions
|
|
- **Files Changed**: `backend/igny8_core/modules/billing/admin.py`
|
|
- **Impact**: Admins can now manually approve payments in Django admin with full automation
|
|
|
|
### 4. Site Creation Permissions
|
|
**Fixed: Site Creation Failing Due to Permission Issues**
|
|
- **Issue**: Users couldn't create sites and were getting logged out
|
|
- **Root Cause**:
|
|
1. `SiteViewSet.get_permissions()` wasn't properly returning instances
|
|
2. Domain field validation rejected empty strings
|
|
- **Fixes Applied**:
|
|
- Updated `get_permissions()` to return instantiated permission classes
|
|
```python
|
|
return [IsAuthenticatedAndActive(), HasTenantAccess(), IsEditorOrAbove()]
|
|
```
|
|
- Modified domain validation to accept empty/None values
|
|
```python
|
|
if not value or value.strip() == '':
|
|
return None
|
|
```
|
|
- **Files Changed**:
|
|
- `backend/igny8_core/auth/views.py`
|
|
- `backend/igny8_core/auth/serializers.py`
|
|
|
|
---
|
|
|
|
## 📦 Commit: 4d13a570 - Payment Methods and Configurations
|
|
|
|
### Payment Method Configuration
|
|
**Added: Global Payment Method Configurations**
|
|
- Created migration `0009_add_missing_payment_methods.py` to add:
|
|
- Bank Transfer (Manual) - Enabled for US, CA, GB, AU, PK, IN, EU
|
|
- Mobile Wallet (Manual) - Enabled for PK, IN
|
|
- Stripe (Disabled) - Configured for future use
|
|
- PayPal (Disabled) - Configured for future use
|
|
|
|
**Added: Database Constraints and Indexes**
|
|
- Migration `0010_add_database_constraints.py`:
|
|
- Added indexes on frequently queried fields
|
|
- Improved query performance for payment and invoice lookups
|
|
- Added constraints for data integrity
|
|
|
|
**Added: Webhook Configuration**
|
|
- Migration `0013_add_webhook_config.py`:
|
|
- Added webhook fields to `PaymentMethodConfig`:
|
|
- `webhook_url`
|
|
- `webhook_secret`
|
|
- `webhook_events` (JSON field)
|
|
- Prepared for Stripe/PayPal webhook integration
|
|
|
|
### Currency Conversion System
|
|
**Added: Multi-Currency Support**
|
|
- Created `backend/igny8_core/business/billing/utils/currency.py`:
|
|
- Currency multipliers for 8 countries (PKR, INR, GBP, CAD, AUD, EUR)
|
|
- `convert_usd_to_local()` function
|
|
- `format_currency()` function
|
|
- `get_currency_for_country()` mapping
|
|
|
|
**Updated: Invoice Creation with Local Currency**
|
|
- Modified `InvoiceService.create_subscription_invoice()`:
|
|
- Converts USD plan prices to local currency
|
|
- Stores original USD price in metadata
|
|
- Stores exchange rate for reference
|
|
- Modified `InvoiceService.create_credit_package_invoice()`:
|
|
- Same currency conversion logic
|
|
|
|
### Frontend Payment Components
|
|
**Added: PaymentHistory Component**
|
|
- Location: `frontend/src/components/billing/PaymentHistory.tsx`
|
|
- Features:
|
|
- Display user's payment history
|
|
- Status indicators (pending, succeeded, failed)
|
|
- Amount and currency display
|
|
- Manual reference and notes
|
|
|
|
**Enhanced: SignUpFormUnified**
|
|
- Updated plan display with currency conversion
|
|
- Dynamic payment method selection based on country
|
|
- Billing information collection for paid plans
|
|
- Payment confirmation modal integration
|
|
|
|
**Enhanced: PaymentConfirmationModal**
|
|
- Fixed amount display with proper currency
|
|
- Support for file upload (proof of payment)
|
|
- Transaction reference input
|
|
- Admin notes field
|
|
|
|
### Payment Workflow Services
|
|
**Added: Email Notification Service**
|
|
- Location: `backend/igny8_core/business/billing/services/email_service.py`
|
|
- Features:
|
|
- Payment confirmation emails
|
|
- Invoice emails
|
|
- Payment approval/rejection notifications
|
|
|
|
**Added: PDF Invoice Generation**
|
|
- Location: `backend/igny8_core/business/billing/services/pdf_service.py`
|
|
- Features:
|
|
- Generate PDF invoices
|
|
- Include company branding
|
|
- Line items and totals
|
|
- Payment instructions
|
|
|
|
**Added: Automated Tasks**
|
|
- `subscription_renewal.py`: Automatic subscription renewal
|
|
- `payment_retry.py`: Retry failed payments
|
|
|
|
### Testing
|
|
**Added: Comprehensive Test Suite**
|
|
- `test_payment_workflow.py`: End-to-end payment testing
|
|
- `test_payment_method_filtering.py`: Payment method availability tests
|
|
- `test_concurrency.py`: Concurrent payment handling tests
|
|
|
|
---
|
|
|
|
## 📦 Commit: 72d0b6b0 - Tenancy Fixes
|
|
|
|
### Subscription Model Improvements
|
|
**Added: Database Constraints**
|
|
- Migration `0012_fix_subscription_constraints.py`:
|
|
- Ensured data integrity for subscription relationships
|
|
- Added proper foreign key constraints
|
|
|
|
**Simplified: Payment Status Flow**
|
|
- Migration `0007_simplify_payment_statuses.py`:
|
|
- Reduced payment statuses to core states
|
|
- Improved status transition logic
|
|
- Clearer admin workflow
|
|
|
|
### Model Enhancements
|
|
**Added: Invoice-Subscription Foreign Key**
|
|
- Migration `0008_add_invoice_subscription_fk.py`:
|
|
- Direct relationship between invoices and subscriptions
|
|
- Improved query performance
|
|
- Better data consistency
|
|
|
|
**Added: Payment-CreditTransaction Link**
|
|
- Migration `0012_add_payment_fk_to_credit_transaction.py`:
|
|
- Track which payment triggered credit addition
|
|
- Audit trail for credit transactions
|
|
- Prevent duplicate credit allocation
|
|
|
|
### Account Model Updates
|
|
**Enhanced: Billing Information Fields**
|
|
- Added comprehensive billing fields to Account model:
|
|
- `billing_email`
|
|
- `billing_address_line1`, `billing_address_line2`
|
|
- `billing_city`, `billing_state`, `billing_postal_code`
|
|
- `billing_country`
|
|
- `tax_id`
|
|
|
|
### Frontend Auth Improvements
|
|
**Enhanced: ProtectedRoute Component**
|
|
- Added 100ms initialization delay
|
|
- Improved token verification
|
|
- Better loading state management
|
|
- Prevents premature redirects
|
|
|
|
**Enhanced: SignUpFormSimplified**
|
|
- Streamlined UI for signup
|
|
- Better error handling
|
|
- Improved validation messages
|
|
|
|
---
|
|
|
|
## 🗂️ Documentation Updates
|
|
|
|
### New Documentation
|
|
1. **PAYMENT-APPROVAL-FIXED.md**: Payment approval workflow guide
|
|
2. **ADMIN-PAYMENT-APPROVAL-GUIDE.md**: Step-by-step admin guide for approving payments
|
|
3. **SIGNUP-FIXES-DEC-9-2024.md**: Detailed signup flow fixes
|
|
|
|
### Updated Documentation Structure
|
|
```
|
|
multi-tenancy/
|
|
├── in-progress/
|
|
│ ├── ADMIN-PAYMENT-APPROVAL-GUIDE.md
|
|
│ ├── PAYMENT-WORKFLOW-QUICK-START.md
|
|
│ ├── SIGNUP-FIXES-DEC-9-2024.md
|
|
│ └── IMPLEMENTATION-STATUS.md
|
|
└── PAYMENT-APPROVAL-FIXED.md
|
|
```
|
|
|
|
---
|
|
|
|
## 📊 Impact Summary
|
|
|
|
### Backend Changes
|
|
- **Models**: 6 new migrations, enhanced Account/Invoice/Payment/Subscription models
|
|
- **Services**: 3 new services (email, PDF, currency conversion)
|
|
- **Admin**: Enhanced payment approval workflow
|
|
- **API**: Fixed registration endpoint, improved invoice serialization
|
|
- **Tasks**: 2 new Celery tasks for automation
|
|
|
|
### Frontend Changes
|
|
- **Components**: 3 new/enhanced components (PaymentHistory, SignUpFormUnified, PaymentConfirmationModal)
|
|
- **Store**: Enhanced authStore with better token handling
|
|
- **Routing**: Improved ProtectedRoute with initialization delay
|
|
|
|
### Database Schema
|
|
- **New Fields**: 15+ new fields across models
|
|
- **New Indexes**: 8+ indexes for performance
|
|
- **New Constraints**: 5+ constraints for data integrity
|
|
- **New Foreign Keys**: 2 new relationships
|
|
|
|
### Testing
|
|
- **New Tests**: 3 comprehensive test files
|
|
- **Coverage**: Payment workflow, concurrency, method filtering
|
|
|
|
---
|
|
|
|
## 🔍 Key Improvements
|
|
|
|
1. **Authentication Flow**: Seamless signup-to-login experience with proper JWT token handling
|
|
2. **Payment Processing**: Complete manual payment workflow with admin approval
|
|
3. **Multi-Currency**: Support for 8 currencies with automatic conversion
|
|
4. **Data Integrity**: Comprehensive constraints and foreign keys
|
|
5. **User Experience**: Better error handling, loading states, and feedback
|
|
6. **Admin Workflow**: One-click payment approval with automatic account activation
|
|
7. **Performance**: Added indexes on frequently queried fields
|
|
8. **Audit Trail**: Metadata tracking for all payment and credit transactions
|
|
|
|
---
|
|
|
|
## 🚀 Next Steps
|
|
|
|
### Immediate Priorities
|
|
1. Test complete signup → payment → activation flow
|
|
2. Verify currency conversion accuracy
|
|
3. Test site creation workflow
|
|
4. Validate webhook configurations
|
|
|
|
### Future Enhancements
|
|
1. Enable Stripe integration
|
|
2. Enable PayPal integration
|
|
3. Add automated payment retry logic
|
|
4. Implement subscription auto-renewal
|
|
5. Add invoice PDF email attachments
|
|
6. Create payment analytics dashboard
|
|
|
|
---
|
|
|
|
## 📝 Notes
|
|
|
|
### Breaking Changes
|
|
- None - all changes are backward compatible
|
|
|
|
### Deprecations
|
|
- Duplicate `AuthViewSet.register()` method (unused, kept for reference)
|
|
|
|
### Known Issues
|
|
- Workflow guide "dismissed" setting 404 error (non-critical, doesn't affect core functionality)
|
|
|
|
---
|
|
|
|
**Last Updated**: December 9, 2024
|
|
**Session Duration**: ~4 hours
|
|
**Files Modified**: 51 files
|
|
**Lines Added**: 5,496
|
|
**Lines Removed**: 181
|