## ✅ Template Editor + Push Notifications ### Backend (PHP) **1. TemplateProvider** (`includes/Core/Notifications/TemplateProvider.php`) - Manages notification templates in wp_options - Default templates for all events x channels - Variable system (order, product, customer, store) - Template CRUD operations - Variable replacement engine **2. PushNotificationHandler** (`includes/Core/Notifications/PushNotificationHandler.php`) - VAPID keys generation and storage - Push subscription management - Queue system for push notifications - User-specific subscriptions - Service worker integration ready **3. NotificationsController** - Extended with: - GET /notifications/templates - List all templates - GET /notifications/templates/:eventId/:channelId - Get template - POST /notifications/templates - Save template - DELETE /notifications/templates/:eventId/:channelId - Reset to default - GET /notifications/push/vapid-key - Get VAPID public key - POST /notifications/push/subscribe - Subscribe to push - POST /notifications/push/unsubscribe - Unsubscribe **4. Push channel added to built-in channels** ### Frontend (React) **1. TemplateEditor Component** (`TemplateEditor.tsx`) - Modal dialog for editing templates - Subject + Body text editors - Variable insertion with dropdown - Click-to-insert variables - Live preview - Save and reset to default - Per event + channel customization **2. Templates Page** - Completely rewritten: - Lists all events x channels - Shows "Custom" badge for customized templates - Edit button opens template editor - Fetches templates from API - Variable reference guide - Organized by channel ### Key Features ✅ **Simple Text Editor** (not HTML builder) - Subject line - Body text with variables - Variable picker - Preview mode ✅ **Variable System** - Order variables: {order_number}, {order_total}, etc. - Customer variables: {customer_name}, {customer_email}, etc. - Product variables: {product_name}, {stock_quantity}, etc. - Store variables: {store_name}, {store_url}, etc. - Click to insert at cursor position ✅ **Push Notifications Ready** - VAPID key generation - Subscription management - Queue system - PWA integration ready - Built-in channel (alongside email) ✅ **Template Management** - Default templates for all events - Per-event, per-channel customization - Reset to default functionality - Custom badge indicator ### Default Templates Included **Email:** - Order Placed, Processing, Completed, Cancelled, Refunded - Low Stock, Out of Stock - New Customer, Customer Note **Push:** - Order Placed, Processing, Completed - Low Stock Alert ### Next Steps 1. ✅ Service worker for push notifications 2. ✅ Push subscription UI in Channels page 3. ✅ Test push notifications 4. ✅ Addon integration examples --- **Ready for testing!** 🚀
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
<?php
|
|
namespace WooNooW\Core;
|
|
|
|
use WooNooW\Core\Features;
|
|
use WooNooW\Admin\Menu;
|
|
use WooNooW\Admin\Assets;
|
|
use WooNooW\Admin\StandaloneAdmin;
|
|
use WooNooW\Compat\HideWooMenus;
|
|
use WooNooW\Compat\MenuProvider;
|
|
use WooNooW\Compat\AddonRegistry;
|
|
use WooNooW\Compat\RouteRegistry;
|
|
use WooNooW\Compat\NavigationRegistry;
|
|
use WooNooW\Compat\PaymentChannels;
|
|
use WooNooW\Compat\SettingsProvider;
|
|
use WooNooW\Admin\Rest\MenuController;
|
|
use WooNooW\Admin\Rest\SettingsController;
|
|
use WooNooW\Api\Routes;
|
|
use WooNooW\Core\Mail\MailQueue;
|
|
use WooNooW\Core\Mail\WooEmailOverride;
|
|
use WooNooW\Core\DataStores\OrderStore;
|
|
use WooNooW\Core\MediaUpload;
|
|
use WooNooW\Core\Notifications\PushNotificationHandler;
|
|
use WooNooW\Branding;
|
|
|
|
class Bootstrap {
|
|
public static function init() {
|
|
Features::init();
|
|
HideWooMenus::init();
|
|
Menu::init();
|
|
Assets::init();
|
|
StandaloneAdmin::init();
|
|
Branding::init();
|
|
MediaUpload::init();
|
|
PushNotificationHandler::init();
|
|
|
|
// Addon system (order matters: Registry → Routes → Navigation)
|
|
AddonRegistry::init();
|
|
RouteRegistry::init();
|
|
NavigationRegistry::init();
|
|
PaymentChannels::init();
|
|
|
|
MenuProvider::init();
|
|
MenuController::init();
|
|
SettingsProvider::init();
|
|
Routes::init();
|
|
MailQueue::init();
|
|
WooEmailOverride::init();
|
|
OrderStore::init();
|
|
}
|
|
} |