Skip to content

Latest commit

 

History

History
77 lines (58 loc) · 4.79 KB

File metadata and controls

77 lines (58 loc) · 4.79 KB

WooCommerce WhatsApp Order Alerts — Pre-Release Walkthrough

Improvements Implemented

1. Onboarding UX

File: settings-page.php

  • When not configured: displays a blue-bordered onboarding banner with a 4-step setup guide
  • When configured: displays a green success banner with "Plugin is configured and notifications are active"
  • Test send button is disabled until configuration is complete

2. Logs Visibility — Formatted Payloads

File: logs-page.php

  • Added wwoa_format_payload() helper that pretty-prints JSON with JSON_PRETTY_PRINT
  • Both request and response payloads now display indented, readable JSON in the expandable details rows
  • Non-JSON payloads pass through unchanged; empty payloads show "—"

3. Order Page UX — Last Status Indicator

File: order-meta-box.php

  • Shows a color-coded status card at the top of the meta box:
    • ✅ Green for "sent" with timestamp
    • ❌ Red for "failed" with timestamp + error message
    • ⏳ Yellow for "pending"
  • History increased from 3 to 5 entries
  • Manual resend button is preserved below the status card

4. Disabled State Feedback

File: class-admin-notices.php

  • Upgraded from warning to error-level notice
  • Lists exactly which config items are missing (endpoint, token, recipients)
  • States: "Notifications are currently inactive" and "Order alerts will NOT be sent"

5. Logs Filtering — Recipient + Trigger Source

Files: logs-page.php, class-logger.php

  • Added "Trigger" dropdown filter (Checkout / Status Change / Manual)
  • Added "Recipient" text input filter (LIKE search for partial matches)
  • Both filters applied in get_logs() and get_log_count() queries
  • Pagination preserves all filter values

6. Provider Error Handling

File: class-generic-whatsapp-provider.php

  • Explicit timeout detection: checks http_request_failed code + "timed out" / "cURL error 28" in message
  • Returns human-readable timeout message: "Request timed out after 15 seconds..."
  • All responses now include error_code field (timeout, http_429, http_500, etc.)
  • Added detail key parsing for Django-style API error responses

7. Hook Coverage

File: class-hooks.php — already implemented at line 41

8. Action Scheduler Pending Jobs Link

File: settings-page.php

  • When configured and Action Scheduler is present, shows "View pending jobs →" link in the status banner
  • Links directly to ?page=action-scheduler&s=wwoa&status=pending

CSS Updates

File: admin.css

  • Onboarding banner styling (gradient background, step list)
  • Active status banner with green theme
  • Last-status indicator cards in meta box (sent/failed/pending)
  • Improved payload <pre> formatting (monospace font, better spacing)

Testing Checklist

  1. Settings page — verify onboarding banner shows when API is not configured
  2. Settings page — configure API, verify green active banner appears with AS link
  3. Admin notices — verify error-level notice shows with specific missing items
  4. Logs page — filter by trigger source and recipient, verify results
  5. Logs page — expand a log row, verify pretty-printed JSON payloads
  6. Order edit — verify last-status card at top of WhatsApp meta box
  7. Test send — verify disabled button when not configured
  8. Test send — verify timeout produces human-readable error