feat: Complete markdown syntax refinement and variable protection
✅ 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
This commit is contained in:
102
EVENT_TEMPLATE_MISMATCH.md
Normal file
102
EVENT_TEMPLATE_MISMATCH.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# Event-Template Mismatch Analysis
|
||||
|
||||
## Current State
|
||||
|
||||
### Events API (`NotificationsController.php`)
|
||||
Defines 9 events total:
|
||||
|
||||
**Staff (4 events):**
|
||||
1. `order_placed` - When order is placed
|
||||
2. `order_cancelled` - When order is cancelled
|
||||
3. `low_stock` - Product stock low
|
||||
4. `out_of_stock` - Product out of stock
|
||||
|
||||
**Customer (5 events):**
|
||||
1. `order_processing` - Order being processed
|
||||
2. `order_completed` - Order completed
|
||||
3. `order_refunded` - Order refunded
|
||||
4. `new_customer` - Customer registers
|
||||
5. `customer_note` - Note added to order
|
||||
|
||||
### DefaultTemplates.php
|
||||
Has 15 templates total:
|
||||
|
||||
**Staff (7 templates):**
|
||||
1. `order_placed` ✅
|
||||
2. `order_processing` ❌ (no event)
|
||||
3. `order_shipped` ❌ (no event)
|
||||
4. `order_completed` ❌ (no event)
|
||||
5. `order_cancelled` ✅
|
||||
6. `payment_received` ❌ (no event)
|
||||
7. `payment_failed` ❌ (no event)
|
||||
|
||||
**Customer (8 templates):**
|
||||
1. `order_placed` ❌ (no event)
|
||||
2. `order_processing` ✅
|
||||
3. `order_shipped` ❌ (no event)
|
||||
4. `order_completed` ✅
|
||||
5. `order_cancelled` ❌ (no event)
|
||||
6. `payment_received` ❌ (no event)
|
||||
7. `payment_failed` ❌ (no event)
|
||||
8. `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):**
|
||||
1. `order_placed` - New order notification
|
||||
2. `order_processing` - Order confirmed, ready to process
|
||||
3. `order_cancelled` - Order cancelled
|
||||
4. `low_stock` - Product stock low
|
||||
5. `out_of_stock` - Product out of stock
|
||||
6. `payment_received` - Payment confirmed
|
||||
7. `payment_failed` - Payment failed
|
||||
|
||||
**Customer Events (8):**
|
||||
1. `order_processing` - Order being processed
|
||||
2. `order_shipped` - Order shipped with tracking
|
||||
3. `order_completed` - Order delivered
|
||||
4. `order_cancelled` - Order cancelled
|
||||
5. `order_refunded` - Order refunded
|
||||
6. `payment_received` - Payment confirmed
|
||||
7. `payment_failed` - Payment failed, retry
|
||||
8. `new_customer` - Welcome email
|
||||
9. `customer_note` - Note added to order
|
||||
|
||||
**Total: 16 events** (7 staff + 9 customer)
|
||||
|
||||
## Action Items
|
||||
|
||||
1. **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`
|
||||
|
||||
2. **Add missing templates to DefaultTemplates.php:**
|
||||
- Customer: `order_refunded`, `customer_note`
|
||||
- Staff: `low_stock`, `out_of_stock`
|
||||
|
||||
3. **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.
|
||||
Reference in New Issue
Block a user