# Changelog

## 3.0.3 - 2026-02-12

**🎯 Merge Tag Intelligence Update**

### Improved

• **Smart Field Matching** - Enhanced merge tag parser with intelligent field detection:
  - Normalizes field labels by removing special characters (handles "Name & Surname", "E-Mail", etc.)
  - Added common field aliases (phone = telephone/mobile/contact number)
  - Better partial matching for complex field names
  - Prevents literal merge tags appearing in webhook data
• **Field Aliases** - Automatic mapping for common variations:
  - Phone: telephone, mobile, cell, contact number
  - Name: first name, full name, your name
  - Surname: last name, family name
  - Email: e-mail, email address
  - Message: comments, enquiry, inquiry, details
  - Plus more for company, address, city, country, date, time
• **Empty Field Handling** - Unmatched merge tags now replaced with empty string instead of showing literal {FieldName}
• **Special Character Support** - Properly handles ampersands, hyphens, and other special characters in field labels

### Technical Details

• Modified `parse_merge_tag()` function with 3-tier matching system:
  1. Exact normalized match (most accurate)
  2. Partial match within field label (flexible)
  3. Alias-based matching (common variations)
• Removes punctuation for comparison while preserving original labels
• Prevents webhook display_data from showing malformed merge tags

---

## 3.0.2 - 2026-02-12

**🔧 Bug Fix Release**

### Fixed

• **CRITICAL: Webhook Edit/Delete Button Issue** - Fixed buttons causing page reload when clicked. Added `type="button"` attribute to Edit and Delete buttons in webhook list to prevent unintended form submission.
• **Improved Webhook Management UX** - Users can now reliably edit and delete webhooks without experiencing page refreshes.

### Technical Details

• Modified `renderWebhooks()` function in JavaScript to include `type="button"` on action buttons
• Prevents default submit behavior when buttons are inside parent `<form>` element
• Maintains all existing webhook functionality without breaking changes

---

## 3.0.1 - 2025-01-XX

**🔧 Maintenance Release**

### Changed

• **Enhanced Button Styling** - Save button now has prominent border accent (2px solid rgba(75, 196, 106, 0.5)) for better visibility
• **Simplified Version Management** - Removed unnecessary `BASECLOUD_UTM_VERSION` constant to match BaseCloud Security Manager pattern
• **Improved Deployment Infrastructure** - Added `.distignore` file for clean WordPress.org releases
• **Code Maintainability** - Hardcoded version display for consistency and reliability
• **Documentation** - Updated changelog formatting for better clarity

## 3.0.0 - 2026-02-12

**🎯 Major Release - Complete Rewrite**

### New Features

• **Complete Architecture Rewrite** - Modern, maintainable codebase
• **Email Tracking** - Track if email notifications were successfully sent
• **Enhanced Merge Tag Parser** - Support for {Entry Date}, {Entry ID}, {User IP}, {Source URL}, {Form Title}
• **Smart Field Matching** - Use simple tags like {Name}, {Email}, {Phone} instead of field IDs
• **Glassmorphism UI** - Beautiful frosted glass design with backdrop blur
• **Webhook Management** - Intuitive inline editor with live preview

### Bug Fixes

• **FIXED: Entry Date Merge Tag** - Now properly displays actual submission timestamp
• **FIXED: Field Detection** - Intelligent partial matching for field labels

### UI/UX Improvements

• **Modern Design** - Enhanced animations, glowing borders, floating logo
• **Better Validation** - Improved form validation and error handling

### Technical Details

• Dual drop-shadow filter on `.bc-logo` for layered glow effect
• New `@keyframes logo-pulse` animation with scale transform
• Enhanced box-shadow values on `.bc-save-btn:hover` for better depth
• Maintains performance with CSS-only animations

---

## 3.0.1 - 2026-02-12

**🔧 CRITICAL FIXES + 🎨 FUTURISTIC UI UPGRADE**

### Critical Fixes

• **FIXED: Entry Date Merge Tag** - Now properly displays actual submission timestamp instead of literal "Entry Date" text
• **FIXED: Field Detection** - Use simple merge tags like {Name}, {Email}, {Phone} instead of guessing field IDs
• **FIXED: Smart Field Matching** - Intelligent partial matching for field labels (e.g., "Name & Surname (First)" matches {Name})

### New Features

• **NEW: Email Tracking System** - Track if email notifications were successfully sent to client inbox
• **NEW: Email Data in Webhook Payload** - Automatically includes:
  - `email_sent` (boolean) - Whether any emails were successfully sent
  - `email_count` (integer) - Total number of email notifications sent
  - `email_notifications` (array) - Detailed info for each email:
    - `success` - Email delivery status
    - `to` - Recipient email address
    - `subject` - Email subject line
    - `timestamp` - When email was sent

### Enhanced Merge Tag System

• **IMPROVED: Entry Properties Support**
  - `{Entry Date}` - Actual submission timestamp
  - `{Entry ID}` - Unique entry identifier
  - `{User IP}` - Submitter's IP address
  - `{Source URL}` - Page where form was submitted
  - `{Form Title}` - Name of the form

• **IMPROVED: Field Label Matching**
  - Use simple field names: `{Name}`, `{Email}`, `{Phone}`, `{Surname}`
  - Smart partial matching finds fields even with complex labels
  - No more guessing field IDs - use what you see in the form!

• **NEW: In-UI Merge Tag Documentation**
  - Helper text shows all available merge tags
  - Examples for Entry Properties, Field Names, and UTM Data
  - Tooltips and guidance for easy configuration

### Futuristic UI Upgrade

**Glassmorphism Design:**
• Beautiful frosted glass effect with backdrop blur
• Translucent containers with gradient backgrounds
• Multi-layer transparency for depth

**Animations & Effects:**
• Shimmer animation sweeping across containers
• Glow pulse effect on active/editing webhooks
• Floating logo with animated drop shadow
• Hover shine effects on buttons
• Smooth cubic-bezier transitions

**Enhanced Visual Design:**
• Deep navy gradient backgrounds (#0a1628, #0f2c52)
• BaseCloud green with glow effects (#4bc46a)
• Neon borders with RGBA transparency
• Multi-layer box shadows with color glows
• Inset lighting effects for depth
• Radial gradients on hover states

**Interactive Elements:**
• Transform animations on hover (translateY, scale)
• Enhanced button gradients with shimmer on hover
• Pulsing glow on active webhooks
• Smooth color transitions

### Technical Improvements

• Enhanced merge tag parser with regex improvements
• Email tracking via `gform_after_email` hook
• Intelligent field label search algorithm
• Better error handling for missing fields
• Optimized CSS with CSS variables
• Keyframe animations for smooth effects

### Example Webhook Payload

```json
{
  "client_id": "326",
  "submission_date": "2026-02-12 14:30:00",
  "display_data": "John Doe - 0123456789 - john@example.com",
  "referrer": "https://tshikwalogamelodge.co.za/",
  "utm_source": "google",
  "utm_campaign": "spring_sale",
  "email_sent": true,
  "email_count": 2,
  "email_notifications": [
    {
      "success": true,
      "to": "client@example.com",
      "subject": "New Form Submission",
      "timestamp": "2026-02-12 14:30:15"
    },
    {
      "success": true,
      "to": "admin@example.com",
      "subject": "Form Notification",
      "timestamp": "2026-02-12 14:30:16"
    }
  ]
}
```

---

## 3.0.0 - 2026-02-12

**🚀 WEBHOOK MANAGEMENT REVOLUTION - Complete Gravity Forms Webhook Replacement**

### Major Features

• **NEW: Custom Webhook Builder** - Replace Gravity Forms webhook add-on with unlimited custom webhooks
• **NEW: Merge Tag Support** - Full Gravity Forms merge tag integration ({Name:1}, {Email:6}, {entry_id}, etc.)
• **NEW: Dynamic Field Mapping** - Select specific fields or send all form data automatically
• **NEW: Two-Column Dashboard** - Professional layout with settings on left, webhooks on right
• **NEW: Unlimited Webhooks** - Add as many webhooks as needed for each form submission
• **NEW: Request Method Selection** - Support for GET, POST, PUT, PATCH, DELETE methods
• **NEW: Individual Webhook Toggle** - Enable/disable webhooks without deleting configuration
• **NEW: In-Place Editing** - Edit webhook configurations inline with smooth animations
• **NEW: BaseCloud Logo** - Professional branding with icon instead of Lottie animation

### Enhanced Features

• **IMPROVED: Webhook System** - Complete webhook management replaces need for Gravity Forms webhook add-on
• **IMPROVED: UTM Injection** - All custom webhooks automatically include UTM parameters
• **IMPROVED: UI/UX** - Wider layout (1400px) with responsive grid design
• **IMPROVED: Form Integration** - Works seamlessly with existing Gravity Forms submissions
• **ENHANCED: Merge Tags** - Support for field IDs, entry data, form data, and UTM parameters
• **ENHANCED: Field Mapping** - Key-value pairs with dynamic merge tag replacement
• **ENHANCED: Security** - AJAX nonce verification for all webhook operations

### Removed Features

• **REMOVED: Denied Webhooks** - Exclusion list removed in favor of individual webhook control
• **REMOVED: Lottie Animation** - Replaced with clean BaseCloud logo for faster loading

### Technical Improvements

• Added webhook storage via WordPress Options API
• New AJAX endpoints: save_webhook, delete_webhook, get_webhooks, get_gf_fields
• Merge tag parser for dynamic field value replacement
• Automatic UTM data injection into all custom webhook payloads
• Database-backed webhook configuration with JSON format
• Real-time webhook list rendering with jQuery
• Form validation and error handling for webhook configuration

### Webhook Features

**Request Configuration:**
- Custom webhook name (required)
- Request URL (required)
- Request method (GET, POST, PUT, PATCH, DELETE)
- Request format (JSON)

**Body Options:**
- All Fields: Automatically includes all form fields + UTM data
- Select Fields: Custom key-value mapping with merge tag support

**Supported Merge Tags:**
- `{FieldLabel:ID}` - Any Gravity Forms field
- `{entry_id}` - Form submission ID
- `{entry_date}` - Submission timestamp
- `{form_id}` - Form ID
- `{form_title}` - Form name
- `{utm_source}`, `{utm_campaign}`, etc. - UTM parameters
- `{gclid}`, `{gbraid}`, `{wbraid}` - Ad tracking IDs
- `{referrer}` - Traffic source URL

### Breaking Changes

• None - Fully backward compatible with v2.x
• All existing COLLECTOR and COURIER functionality preserved
• Elementor, WPForms, and CF7 integrations unchanged

### Migration Notes

If you were using Gravity Forms webhook add-on:
1. Configure your webhooks in the new Webhook Management panel
2. Use "Select Fields" to map form data with merge tags
3. Disable or remove old Gravity Forms webhook feeds
4. All UTM data is automatically included in every webhook

---

## 2.3.3 - 2024-03-15

**Lottie Logo Fix**

• Fixed Lottie player script loading order to display logo properly
• Changed script loading from footer to header for immediate availability
• Resolved warning icon display issue on page load

---

## 2.3.2 - 2024-03-01

**Animated Logo Addition**

• Added animated BaseCloud Lottie logo to settings page header
• Enhanced brand presence with looping logo animation
• Improved visual consistency with BaseCloud brand identity

---

## 2.3.1 - 2024-02-15

**API Endpoint Update**

• **UPDATED: Default Webhook URL** - Migrated from legacy portal.basecloudglobal.com to new api.basecloudglobal.com endpoint
• **IMPROVED: URL Format** - New webhook URLs use /webhook/ path structure for better API organization
• **ENHANCED: Security** - Updated default excluded webhook to new API endpoint
• **BACKWARD COMPATIBLE** - No impact on existing installations or custom excluded URLs

