✅ New cleaner syntax implemented: - [card:type] instead of [card type='type'] - [button:style](url)Text[/button] instead of [button url='...' style='...'] - Standard markdown images:  ✅ Variable protection from markdown parsing: - Variables with underscores (e.g., {order_items_table}) now protected - HTML comment placeholders prevent italic/bold parsing - All variables render correctly in preview ✅ Button rendering fixes: - Buttons work in Visual mode inside cards - Buttons work in Preview mode - Button clicks prevented in visual editor - Proper styling for solid and outline buttons ✅ Backward compatibility: - Old syntax still supported - No breaking changes ✅ Bug fixes: - Fixed order_item_table → order_items_table naming - Fixed button regex to match across newlines - Added button/image parsing to parseMarkdownBasics - Prevented button clicks on .button and .button-outline classes 📚 Documentation: - NEW_MARKDOWN_SYNTAX.md - Complete user guide - MARKDOWN_SYNTAX_AND_VARIABLES.md - Technical analysis
3.2 KiB
Event-Template Mismatch Analysis
Current State
Events API (NotificationsController.php)
Defines 9 events total:
Staff (4 events):
order_placed- When order is placedorder_cancelled- When order is cancelledlow_stock- Product stock lowout_of_stock- Product out of stock
Customer (5 events):
order_processing- Order being processedorder_completed- Order completedorder_refunded- Order refundednew_customer- Customer registerscustomer_note- Note added to order
DefaultTemplates.php
Has 15 templates total:
Staff (7 templates):
order_placed✅order_processing❌ (no event)order_shipped❌ (no event)order_completed❌ (no event)order_cancelled✅payment_received❌ (no event)payment_failed❌ (no event)
Customer (8 templates):
order_placed❌ (no event)order_processing✅order_shipped❌ (no event)order_completed✅order_cancelled❌ (no event)payment_received❌ (no event)payment_failed❌ (no event)new_customer✅
Missing from templates:
order_refunded(customer)customer_note(customer)low_stock(staff)out_of_stock(staff)
The Problem
Templates exist without events - These templates will never be used because no event triggers them.
Events exist without templates - These events will use fallback templates.
Recommended Solution
Events API should be the source of truth. Add missing events to match a complete e-commerce notification system:
Proposed Complete Event List
Staff Events (7):
order_placed- New order notificationorder_processing- Order confirmed, ready to processorder_cancelled- Order cancelledlow_stock- Product stock lowout_of_stock- Product out of stockpayment_received- Payment confirmedpayment_failed- Payment failed
Customer Events (8):
order_processing- Order being processedorder_shipped- Order shipped with trackingorder_completed- Order deliveredorder_cancelled- Order cancelledorder_refunded- Order refundedpayment_received- Payment confirmedpayment_failed- Payment failed, retrynew_customer- Welcome emailcustomer_note- Note added to order
Total: 16 events (7 staff + 9 customer)
Action Items
-
Add missing events to NotificationsController.php:
- Staff:
order_processing,order_shipped,order_completed,payment_received,payment_failed - Customer:
order_placed,order_shipped,order_cancelled,payment_received,payment_failed
- Staff:
-
Add missing templates to DefaultTemplates.php:
- Customer:
order_refunded,customer_note - Staff:
low_stock,out_of_stock
- Customer:
-
Update TemplateProvider.php to handle all events
Why Events API is Source of Truth
- Events define what actually happens in the system
- Templates are just content for those events
- If an event doesn't exist, the template is useless
- If a template doesn't exist, we can create a fallback
Conclusion: Expand Events API to include all meaningful e-commerce notifications, then ensure templates exist for each.