- Added new Markdown Editor with live preview, GFM support, PDF/HTML/DOCX export - Upgraded all paste fields to CodeMirror with syntax highlighting and expand/collapse - Enhanced Object Editor with advanced URL fetching and preview mode - Improved export views with syntax highlighting in Table/Object editors - Implemented SEO improvements (FAQ schema, breadcrumbs, internal linking) - Added Related Tools recommendations component - Created custom 404 page with tool suggestions - Consolidated tools: removed JSON, Serialize, CSV-JSON (merged into main editors) - Updated documentation and cleaned up redundant files - Updated release notes with user-centric improvements
5.2 KiB
Feature Toggle System - FREE vs PRO
Overview
The Advanced URL Fetch feature is now a PRO feature with a toggle system that supports FREE and PRO tiers.
Files Created
1. /src/config/features.js
Purpose: Central configuration for all FREE/PRO features
Key Functions:
getCurrentUserTier()- Returns current user tier (static for now, will be dynamic)isFeatureEnabled(featureName)- Check if a feature is enabled for current userisProUser()- Quick check if user is PROgetFeatureInfo(featureName)- Get feature metadata
Current Features:
ADVANCED_URL_FETCH- PRO onlyBULK_OPERATIONS- PRO only (placeholder)EXPORT_TEMPLATES- PRO only (placeholder)CLOUD_SYNC- PRO only (placeholder)
How to Toggle for Testing:
// In /src/config/features.js, line ~15
const staticTier = USER_TIER.FREE; // Change to USER_TIER.PRO to test
2. /src/components/ProBadge.js
Purpose: Reusable Pro badge and feature lock components
Components:
<ProBadge />- Shows PRO badge (3 variants: badge, button, inline)<ProFeatureLock />- Shows locked feature message with upgrade prompt
Usage Examples:
// Simple badge
<ProBadge size="sm" />
// Upgrade button
<ProBadge variant="button" onClick={handleUpgrade} />
// Inline text
<ProBadge variant="inline" size="xs" />
// Feature lock message
<ProFeatureLock
featureName="Advanced URL Fetch"
featureDescription="Custom headers, auth, and more"
onUpgrade={handleUpgrade}
/>
3. /src/components/AdvancedURLFetch.js (Updated)
Purpose: URL fetch component with FREE/PRO support
Changes:
- Imports feature toggle system
- Shows PRO badge on "Show Advanced Options" button
- Displays
<ProFeatureLock />when user is FREE tier - Shows full advanced options when user is PRO tier
User Experience
FREE Tier Users:
- See basic URL input with GET method only
- See "Show Advanced Options" button with PRO badge
- Click button → See feature lock message with upgrade prompt
- Can still use basic URL fetch (current functionality)
PRO Tier Users:
- See basic URL input with method selector (GET/POST/PUT/DELETE/PATCH)
- See "Show Advanced Options" button (no PRO badge)
- Click button → See full advanced options:
- Query Parameters builder
- Custom Headers
- Authentication (Bearer, API Key, Basic Auth)
- Request Body editor
- Save/Load Presets
Integration Guide
In ObjectEditor or TableEditor:
import AdvancedURLFetch from '../components/AdvancedURLFetch';
// In component:
const [showAdvanced, setShowAdvanced] = useState(false);
const handleUpgrade = () => {
// Navigate to pricing page or show upgrade modal
alert('Upgrade to PRO!');
};
// In JSX:
<AdvancedURLFetch
url={fetchUrl}
onUrlChange={setFetchUrl}
onFetch={handleFetchData}
fetching={fetching}
showAdvanced={showAdvanced}
onToggleAdvanced={() => setShowAdvanced(!showAdvanced)}
onUpgrade={handleUpgrade}
/>
Future: Dynamic Tier from Database
When implementing authentication and database:
// /src/config/features.js
export const getCurrentUserTier = () => {
// Replace static tier with:
const user = getUserFromAuth(); // Your auth function
return user?.tier || USER_TIER.FREE;
};
// Or with API call:
export const getCurrentUserTier = async () => {
const response = await fetch('/api/user/tier');
const data = await response.json();
return data.tier || USER_TIER.FREE;
};
Adding New PRO Features
- Add to features.js:
export const FEATURES = {
// ... existing features
MY_NEW_FEATURE: {
name: 'My New Feature',
description: 'Description of what it does',
tier: USER_TIER.PRO,
enabled: (userTier) => userTier === USER_TIER.PRO
}
};
- Use in component:
import { isFeatureEnabled } from '../config/features';
const MyComponent = () => {
const isEnabled = isFeatureEnabled('MY_NEW_FEATURE');
return (
<div>
{isEnabled ? (
<ProFeature />
) : (
<ProFeatureLock featureName="My New Feature" />
)}
</div>
);
};
Testing
Test as FREE user:
- Keep
staticTier = USER_TIER.FREEin features.js - Run dev server:
npm start - Go to Object Editor → URL tab
- Click "Show Advanced Options"
- Should see PRO lock message
Test as PRO user:
- Change to
staticTier = USER_TIER.PROin features.js - Restart dev server
- Go to Object Editor → URL tab
- Click "Show Advanced Options"
- Should see full advanced options
Benefits
✅ Clean Separation: FREE and PRO features clearly separated ✅ Easy Testing: Toggle tier with one line change ✅ Reusable Components: ProBadge and ProFeatureLock can be used anywhere ✅ Future-Ready: Easy to connect to real authentication/database ✅ User-Friendly: Clear upgrade prompts with feature descriptions ✅ Maintainable: All feature flags in one central location
Next Steps
- ✅ Feature toggle system created
- ✅ Pro badge components created
- ✅ AdvancedURLFetch updated with FREE/PRO support
- ⏳ Integrate into ObjectEditor
- ⏳ Integrate into TableEditor
- ⏳ Create pricing/upgrade page
- ⏳ Implement authentication system
- ⏳ Connect to database for dynamic tier management