docs: add missing documentation for new features (checkout auto-registration, visual builder sections, appearance toggles, software & subscription guides)
This commit is contained in:
@@ -1,19 +1,182 @@
|
||||
---
|
||||
title: Module Integration
|
||||
description: Integrating Addons usage with Module Registry
|
||||
date: 2024-01-31
|
||||
title: Module Registry
|
||||
description: Register custom modules and addons with WooNooW's unified module system
|
||||
---
|
||||
|
||||
WooNooW's modular architecture allows developers to create custom modules and addons that integrate seamlessly with the **Settings > Modules** UI.
|
||||
|
||||
## Overview
|
||||
|
||||
## Vision
|
||||
The Module Registry provides a unified system for:
|
||||
- Enable/disable toggle in the admin UI
|
||||
- Custom settings with schema-based forms
|
||||
- Dependencies on other modules
|
||||
- SPA route registration for custom settings pages
|
||||
|
||||
**Module Registry as the Single Source of Truth.**
|
||||
Functionality extensions—whether built-in Modules or external Addons—should live in the same UI.
|
||||
## Registering a Module
|
||||
|
||||
## Registration
|
||||
Add your module using the `woonoow/modules/registry` filter:
|
||||
|
||||
Addons register themselves via the `woonoow/addon_registry` filter.
|
||||
```php
|
||||
add_filter('woonoow/modules/registry', 'my_plugin_register_module');
|
||||
|
||||
function my_plugin_register_module($modules) {
|
||||
$modules['my-module'] = [
|
||||
'id' => 'my-module',
|
||||
'name' => __('My Custom Module', 'my-plugin'),
|
||||
'description' => __('Description of what this module does.', 'my-plugin'),
|
||||
'icon' => 'Sparkles', // Lucide icon name
|
||||
'category' => 'marketing', // marketing, sales, developer, etc.
|
||||
'requires' => [], // Array of required module IDs
|
||||
'settings' => [], // Settings schema array
|
||||
];
|
||||
|
||||
return $modules;
|
||||
}
|
||||
```
|
||||
|
||||
## Module Properties
|
||||
|
||||
| Property | Type | Required | Description |
|
||||
|----------|------|----------|-------------|
|
||||
| `id` | string | Yes | Unique identifier (lowercase, hyphens) |
|
||||
| `name` | string | Yes | Display name in the UI |
|
||||
| `description` | string | Yes | Brief description of functionality |
|
||||
| `icon` | string | No | Lucide icon name (e.g., `Package`, `Mail`) |
|
||||
| `category` | string | No | Grouping category: `marketing`, `sales`, `developer` |
|
||||
| `requires` | array | No | Array of module IDs this depends on |
|
||||
| `settings` | array | No | Settings schema for module configuration |
|
||||
|
||||
---
|
||||
|
||||
## Settings Schema
|
||||
|
||||
Define a settings schema to allow users to configure your module:
|
||||
|
||||
```php
|
||||
'settings' => [
|
||||
[
|
||||
'id' => 'api_key',
|
||||
'type' => 'text',
|
||||
'label' => __('API Key', 'my-plugin'),
|
||||
'description' => __('Enter your API key', 'my-plugin'),
|
||||
'default' => '',
|
||||
],
|
||||
[
|
||||
'id' => 'rate_limit',
|
||||
'type' => 'number',
|
||||
'label' => __('Rate Limit', 'my-plugin'),
|
||||
'description' => __('Max requests per minute', 'my-plugin'),
|
||||
'default' => 10,
|
||||
'min' => 1,
|
||||
'max' => 100,
|
||||
],
|
||||
[
|
||||
'id' => 'enable_debug',
|
||||
'type' => 'toggle',
|
||||
'label' => __('Enable Debug Mode', 'my-plugin'),
|
||||
'default' => false,
|
||||
],
|
||||
],
|
||||
```
|
||||
|
||||
### Available Field Types
|
||||
|
||||
| Type | Description | Properties |
|
||||
|------|-------------|------------|
|
||||
| `text` | Single-line text input | `default`, `placeholder` |
|
||||
| `textarea` | Multi-line text input | `default`, `rows` |
|
||||
| `number` | Numeric input with validation | `default`, `min`, `max`, `step` |
|
||||
| `toggle` | Boolean on/off switch | `default` (true/false) |
|
||||
| `select` | Dropdown selection | `default`, `options` (array of `{value, label}`) |
|
||||
| `checkbox` | Single checkbox | `default` (true/false) |
|
||||
| `color` | Color picker | `default` (#hex value) |
|
||||
| `url` | URL input with validation | `default`, `placeholder` |
|
||||
| `email` | Email input with validation | `default`, `placeholder` |
|
||||
| `password` | Password input (masked) | `default` |
|
||||
|
||||
### Common Field Properties
|
||||
|
||||
| Property | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `id` | string | Unique field identifier |
|
||||
| `type` | string | Field type from list above |
|
||||
| `label` | string | Display label |
|
||||
| `description` | string | Help text below field |
|
||||
| `default` | mixed | Default value |
|
||||
|
||||
### Select Field Example
|
||||
|
||||
```php
|
||||
[
|
||||
'id' => 'display_mode',
|
||||
'type' => 'select',
|
||||
'label' => __('Display Mode', 'my-plugin'),
|
||||
'default' => 'grid',
|
||||
'options' => [
|
||||
['value' => 'grid', 'label' => __('Grid', 'my-plugin')],
|
||||
['value' => 'list', 'label' => __('List', 'my-plugin')],
|
||||
['value' => 'carousel', 'label' => __('Carousel', 'my-plugin')],
|
||||
],
|
||||
],
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Checking Module Status
|
||||
|
||||
Use `ModuleRegistry::is_enabled()` to check if your module is active:
|
||||
|
||||
```php
|
||||
use WooNooW\Core\ModuleRegistry;
|
||||
|
||||
if (ModuleRegistry::is_enabled('my-module')) {
|
||||
// Module is enabled, initialize features
|
||||
My_Module_Manager::init();
|
||||
}
|
||||
```
|
||||
|
||||
## Module Lifecycle Events
|
||||
|
||||
Hook into module enable/disable events:
|
||||
|
||||
```php
|
||||
// When any module is enabled
|
||||
add_action('woonoow/module/enabled', function($module_id) {
|
||||
if ($module_id === 'my-module') {
|
||||
// Create database tables, initialize settings, etc.
|
||||
My_Module_Manager::install();
|
||||
}
|
||||
});
|
||||
|
||||
// When any module is disabled
|
||||
add_action('woonoow/module/disabled', function($module_id) {
|
||||
if ($module_id === 'my-module') {
|
||||
// Cleanup if necessary
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## SPA Routes for Settings Pages
|
||||
|
||||
Addons can register custom React settings pages:
|
||||
|
||||
```php
|
||||
add_filter('woonoow/spa_routes', function($routes) {
|
||||
$routes[] = [
|
||||
'path' => '/settings/my-addon',
|
||||
'component_url' => plugin_dir_url(__FILE__) . 'dist/Settings.js',
|
||||
'title' => 'My Addon Settings',
|
||||
];
|
||||
return $routes;
|
||||
});
|
||||
```
|
||||
|
||||
## Addon Registry (External Addons)
|
||||
|
||||
External addons can also register via `woonoow/addon_registry` for extended metadata:
|
||||
|
||||
```php
|
||||
add_filter('woonoow/addon_registry', function($addons) {
|
||||
@@ -32,19 +195,49 @@ add_filter('woonoow/addon_registry', function($addons) {
|
||||
});
|
||||
```
|
||||
|
||||
This ensures your addon appears in the **WooNooW Modules** list with a consistent UI, toggle switch, and settings link.
|
||||
---
|
||||
|
||||
## Settings Pages
|
||||
|
||||
Addons can register their own SPA routes for settings pages.
|
||||
## Complete Example
|
||||
|
||||
```php
|
||||
add_filter('woonoow/spa_routes', function($routes) {
|
||||
$routes[] = [
|
||||
'path' => '/settings/shipping/my-addon',
|
||||
'component_url' => plugin_dir_url(__FILE__) . 'dist/Settings.js',
|
||||
'title' => 'My Addon Settings',
|
||||
];
|
||||
return $routes;
|
||||
});
|
||||
<?php
|
||||
namespace MyPlugin;
|
||||
|
||||
class MyModuleSettings {
|
||||
|
||||
public static function init() {
|
||||
add_filter('woonoow/modules/registry', [__CLASS__, 'register']);
|
||||
}
|
||||
|
||||
public static function register($modules) {
|
||||
$modules['my-module'] = [
|
||||
'id' => 'my-module',
|
||||
'name' => __('My Module', 'my-plugin'),
|
||||
'description' => __('Adds awesome features to your store.', 'my-plugin'),
|
||||
'icon' => 'Zap',
|
||||
'category' => 'marketing',
|
||||
'requires' => [], // No dependencies
|
||||
'settings' => [
|
||||
[
|
||||
'id' => 'feature_enabled',
|
||||
'type' => 'toggle',
|
||||
'label' => __('Enable Feature', 'my-plugin'),
|
||||
'default' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return $modules;
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize on plugins_loaded
|
||||
add_action('plugins_loaded', ['MyPlugin\MyModuleSettings', 'init']);
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Check module status** before loading heavy features
|
||||
2. **Use the `woonoow/module/enabled` hook** to run installation routines only when needed
|
||||
3. **Specify dependencies** so WooNooW can prompt users to enable required modules
|
||||
4. **Provide meaningful descriptions** to help users understand what each module does
|
||||
|
||||
87
contents/docs/developer/api/licensing/index.mdx
Normal file
87
contents/docs/developer/api/licensing/index.mdx
Normal file
@@ -0,0 +1,87 @@
|
||||
---
|
||||
title: Licensing API
|
||||
description: Endpoints for activating, validating, and managing licenses
|
||||
date: 2024-01-31
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
The Licensing API allows external applications to interact with the WooNooW licensing system.
|
||||
|
||||
**Base URL**: `https://your-domain.com/wp-json/woonoow/v1`
|
||||
|
||||
---
|
||||
|
||||
## Public Endpoints
|
||||
|
||||
### Activate License
|
||||
|
||||
Activates a license key for a specific domain.
|
||||
|
||||
```http
|
||||
POST /licenses/activate
|
||||
```
|
||||
|
||||
#### Activation Parameters
|
||||
|
||||
| Body Params | Type | Required | Description |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `license_key` | `string` | **Yes** | The license key to activate |
|
||||
| `domain` | `string` | **Yes** | The domain where the software is installed |
|
||||
| `activation_mode` | `string` | No | Set to `oauth` to trigger OAuth flow |
|
||||
|
||||
#### Responses
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"activation_id": 123,
|
||||
"license_key": "XXXX-YYYY-ZZZZ-WWWW",
|
||||
"status": "active"
|
||||
}
|
||||
```
|
||||
|
||||
If OAuth is required:
|
||||
|
||||
```json
|
||||
{
|
||||
"success": false,
|
||||
"oauth_required": true,
|
||||
"oauth_redirect": "https://vendor.com/my-account/license-connect/...",
|
||||
"state": "abc12345"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Validate License
|
||||
|
||||
Checks if a license key is valid and active for the current domain.
|
||||
|
||||
```http
|
||||
POST /licenses/validate
|
||||
```
|
||||
|
||||
#### Validation Parameters
|
||||
|
||||
| Body Params | Type | Required | Description |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `license_key` | `string` | **Yes** | The license key to validate |
|
||||
| `domain` | `string` | **Yes** | The domain to check against |
|
||||
|
||||
---
|
||||
|
||||
### Deactivate License
|
||||
|
||||
Deactivates a license for the current domain.
|
||||
|
||||
```http
|
||||
POST /licenses/deactivate
|
||||
```
|
||||
|
||||
#### Deactivation Parameters
|
||||
|
||||
| Body Params | Type | Required | Description |
|
||||
| :--- | :--- | :--- | :--- |
|
||||
| `license_key` | `string` | **Yes** | The license key to deactivate |
|
||||
| `domain` | `string` | **Yes** | The domain to remove |
|
||||
218
contents/docs/developer/software-updates/index.mdx
Normal file
218
contents/docs/developer/software-updates/index.mdx
Normal file
@@ -0,0 +1,218 @@
|
||||
---
|
||||
title: Software Updates API
|
||||
description: Distribute software updates with license-based access control
|
||||
---
|
||||
|
||||
The Software Distribution module enables selling WordPress plugins, themes, or any software with automatic update checking, secure downloads, and version management.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Enable **Licensing** module (required)
|
||||
- Enable **Software Distribution** module in Settings → Modules
|
||||
- Configure downloadable products with software distribution enabled
|
||||
|
||||
## Product Configuration
|
||||
|
||||
When editing a downloadable product in WooCommerce, you'll see a new "Software Distribution" section:
|
||||
|
||||
| Field | Description |
|
||||
|-------|-------------|
|
||||
| **Enable Software Updates** | Allow customers to check for updates via API |
|
||||
| **Software Slug** | Unique identifier (e.g., `my-plugin`) used in API calls |
|
||||
| **Current Version** | Latest version number (e.g., `1.2.3`) |
|
||||
|
||||
### WordPress Integration (Optional)
|
||||
|
||||
Enable "WordPress Plugin/Theme" to add these fields:
|
||||
|
||||
- **Requires WP** - Minimum WordPress version
|
||||
- **Tested WP** - Tested up to WordPress version
|
||||
- **Requires PHP** - Minimum PHP version
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### Check for Updates
|
||||
|
||||
```
|
||||
GET /wp-json/woonoow/v1/software/check
|
||||
POST /wp-json/woonoow/v1/software/check
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
|-----------|------|----------|-------------|
|
||||
| `license_key` | string | Yes | Valid license key |
|
||||
| `slug` | string | Yes | Software slug |
|
||||
| `version` | string | Yes | Current installed version |
|
||||
| `site_url` | string | No | Site URL for tracking |
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"update_available": true,
|
||||
"product": {
|
||||
"name": "My Plugin",
|
||||
"slug": "my-plugin"
|
||||
},
|
||||
"current_version": "1.0.0",
|
||||
"latest_version": "1.2.0",
|
||||
"changelog": "## What's New\n- Added feature X\n- Fixed bug Y",
|
||||
"release_date": "2026-02-01 12:00:00",
|
||||
"download_url": "https://your-store.com/wp-json/woonoow/v1/software/download?token=..."
|
||||
}
|
||||
```
|
||||
|
||||
For WordPress plugins/themes, an additional `wordpress` object is included:
|
||||
|
||||
```json
|
||||
{
|
||||
"wordpress": {
|
||||
"requires": "6.0",
|
||||
"tested": "6.7",
|
||||
"requires_php": "7.4",
|
||||
"icons": { "1x": "...", "2x": "..." },
|
||||
"banners": { "low": "...", "high": "..." }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Download File
|
||||
|
||||
```
|
||||
GET /wp-json/woonoow/v1/software/download?token=<token>
|
||||
```
|
||||
|
||||
Download tokens are single-use and expire after 5 minutes.
|
||||
|
||||
### Get Changelog
|
||||
|
||||
```
|
||||
GET /wp-json/woonoow/v1/software/changelog?slug=<slug>
|
||||
GET /wp-json/woonoow/v1/software/changelog?slug=<slug>&version=<version>
|
||||
```
|
||||
|
||||
Returns version history with changelogs.
|
||||
|
||||
## WordPress Client Integration
|
||||
|
||||
Include the updater class in your plugin or theme to enable automatic updates:
|
||||
|
||||
### 1. Copy the Updater Class
|
||||
|
||||
Copy `class-woonoow-updater.php` from the WooNooW plugin's `templates/updater/` directory to your plugin.
|
||||
|
||||
### 2. Initialize in Your Plugin
|
||||
|
||||
```php
|
||||
<?php
|
||||
// In your main plugin file
|
||||
|
||||
require_once plugin_dir_path(__FILE__) . 'includes/class-woonoow-updater.php';
|
||||
|
||||
new WooNooW_Updater([
|
||||
'api_url' => 'https://your-store.com/',
|
||||
'slug' => 'my-plugin',
|
||||
'version' => MY_PLUGIN_VERSION,
|
||||
'license_key' => get_option('my_plugin_license_key'),
|
||||
'plugin_file' => __FILE__,
|
||||
]);
|
||||
```
|
||||
|
||||
### 3. For Themes
|
||||
|
||||
```php
|
||||
<?php
|
||||
// In your theme's functions.php
|
||||
|
||||
require_once get_theme_file_path('includes/class-woonoow-updater.php');
|
||||
|
||||
new WooNooW_Updater([
|
||||
'api_url' => 'https://your-store.com/',
|
||||
'slug' => 'my-theme',
|
||||
'version' => wp_get_theme()->get('Version'),
|
||||
'license_key' => get_option('my_theme_license_key'),
|
||||
'theme_slug' => 'my-theme',
|
||||
]);
|
||||
```
|
||||
|
||||
## Non-WordPress Integration
|
||||
|
||||
For other software types, make HTTP requests directly to the API:
|
||||
|
||||
### JavaScript Example
|
||||
|
||||
```javascript
|
||||
async function checkForUpdates(licenseKey, currentVersion) {
|
||||
const response = await fetch('https://your-store.com/wp-json/woonoow/v1/software/check', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
license_key: licenseKey,
|
||||
slug: 'my-software',
|
||||
version: currentVersion,
|
||||
}),
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.update_available) {
|
||||
console.log(`Update available: v${data.latest_version}`);
|
||||
// Download from data.download_url
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
```
|
||||
|
||||
### Python Example
|
||||
|
||||
```python
|
||||
import requests
|
||||
|
||||
def check_for_updates(license_key: str, current_version: str) -> dict:
|
||||
response = requests.post(
|
||||
'https://your-store.com/wp-json/woonoow/v1/software/check',
|
||||
json={
|
||||
'license_key': license_key,
|
||||
'slug': 'my-software',
|
||||
'version': current_version,
|
||||
}
|
||||
)
|
||||
|
||||
data = response.json()
|
||||
|
||||
if data.get('update_available'):
|
||||
print(f"Update available: v{data['latest_version']}")
|
||||
# Download from data['download_url']
|
||||
|
||||
return data
|
||||
```
|
||||
|
||||
## Managing Versions
|
||||
|
||||
Use the Admin SPA at **Products → Software Versions** to:
|
||||
|
||||
- View all software-enabled products
|
||||
- Release new versions with changelogs
|
||||
- Track download counts per version
|
||||
- Set current (latest) version
|
||||
|
||||
## Error Codes
|
||||
|
||||
| Error | Description |
|
||||
|-------|-------------|
|
||||
| `invalid_license` | License key is invalid or expired |
|
||||
| `product_not_found` | Software slug doesn't match any product |
|
||||
| `software_disabled` | Software distribution not enabled for product |
|
||||
| `invalid_token` | Download token expired or already used |
|
||||
| `module_disabled` | Software Distribution module is disabled |
|
||||
|
||||
## Security
|
||||
|
||||
- All API endpoints require valid license key
|
||||
- Download tokens are single-use and expire in 5 minutes
|
||||
- Rate limiting: 10 requests/minute per license (configurable)
|
||||
- IP address logged with download tokens
|
||||
45
contents/docs/developer/software-updates/store-owner.mdx
Normal file
45
contents/docs/developer/software-updates/store-owner.mdx
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: Store Owner Guide
|
||||
description: Managing and distributing digital software products.
|
||||
---
|
||||
|
||||
WooNooW's Software Updates module allows you to securely sell, distribute, and manage updates for your digital products, plugins, or applications.
|
||||
|
||||
## Enabling the Software Module
|
||||
To begin distributing software, you must first enable the module:
|
||||
1. Navigate to **WooNooW > Settings > Modules**.
|
||||
2. Toggle on the **Software Updates** module.
|
||||
3. Save changes.
|
||||
|
||||
## Creating a Software Product
|
||||
Software products are created by extending standard WooCommerce virtual products.
|
||||
|
||||
1. Go to **Products > Add New** in WordPress.
|
||||
2. Check both the **Virtual** and **Downloadable** checkboxes in the Product Data panel.
|
||||
3. In the left tabs, select **Software Details**.
|
||||
4. Configure the following specific to your software:
|
||||
- **Software Type:** Identify the platform (e.g., WordPress Plugin, Desktop App).
|
||||
- **Current Version:** The latest release version (e.g., 1.2.0).
|
||||
- **Requires PHP/WP:** Set minimum system requirements (optional).
|
||||
- **Tested Up To:** Set the maximum compatible platform version (optional).
|
||||
5. Add your downloadable file under the standard **Downloadable** tab.
|
||||
6. Publish the product.
|
||||
|
||||
## Managing Version History
|
||||
When you release an update:
|
||||
1. Navigate to **Store > Software Versions** in your WooNooW Admin SPA.
|
||||
2. Click **Create Release**.
|
||||
3. Select the software product you are updating.
|
||||
4. Enter the new **Version Number** (e.g., 1.3.0).
|
||||
5. Provide a detailed **Changelog**. Use Markdown to list features, fixes, and notes.
|
||||
6. Publish the release.
|
||||
|
||||
When customers check for updates within their application (using the API), the system will serve them the latest version and display this changelog.
|
||||
|
||||
## Licensing
|
||||
You can choose to attach License Keys to your software to prevent unauthorized use.
|
||||
1. Enable the **Licensing** module in Settings.
|
||||
2. When configuring your Software Product, check the **Requires License** box.
|
||||
3. Define the activation limit (e.g., 1 site, 5 sites, or unlimited).
|
||||
|
||||
When a customer purchases the software, the system will automatically generate a unique license key and deliver it in the checkout confirmation and email receipt. Customers can manage their active activations from their **My Account > Licenses** dashboard.
|
||||
Reference in New Issue
Block a user