License & Setup
All Pro components require a valid license key. Wrap your app with FieldCraftProProvider to enable them.
Install
Provider Setup
Wrap the part of your app that uses Pro components with the provider. Pass your license key via an environment variable:
Environment variable: Add NEXT_PUBLIC_FCPRO_LICENSE_KEY=your-key-here to your .env file. Never commit license keys to version control.
How It Works
When a Pro component mounts, it checks the nearest FieldCraftProProvider for a valid license. If the key is missing or invalid, the component renders with a watermark overlay.
- Valid key — component renders normally
- Invalid or expired key — component renders with a watermark
- No provider — component renders with a watermark
Checking License Status
Use the useLicense hook to read the current license status from any component inside the provider:
Exports
| Export | Type | Description |
|---|---|---|
FieldCraftProProvider | Component | License context provider |
useLicense | Hook | Returns status and tier |
requireLicense | HOC | Wraps a component with license enforcement |
validateLicense | Function | Validates a license key string |
tierHasFeature | Function | Check if a tier includes a feature |
UnlicensedWatermark | Component | Watermark overlay for unlicensed components |