feat: premium UI overhaul, AI suggestions, WAHA WhatsApp integration

PREMIUM UI:
- All animations: fade-up, scale-in, stagger children, confetti celebration
- Glass effects, gradient icons, premium card hover states
- Custom CSS: shimmer, pulse-ring, bounce, counter-roll animations
- Smooth progress bar with gradient

AI-POWERED (GPT-4o-mini nano model):
- Smart amount suggestions based on peer data (/api/ai/suggest)
- Social proof: '42 people pledged · Average £85'
- AI-generated nudge text for conversion
- AI fuzzy matching for bank reconciliation
- AI reminder message generation

WAHA WHATSAPP INTEGRATION:
- Auto-send pledge receipt with bank details via WhatsApp
- 4-step reminder sequence: gentle → nudge → urgent → final
- Chatbot: donors reply PAID, HELP, CANCEL, STATUS
- Volunteer notification on new pledges
- WhatsApp status in dashboard settings
- Webhook endpoint for incoming messages

DONOR FLOW (CRO):
- Amount step: AI suggestions, Gift Aid preview, social proof, haptic feedback
- Payment step: trust signals, fee comparison, benefit badges
- Identity step: email/phone toggle, WhatsApp reminder indicator
- Bank instructions: tap-to-copy each field, WhatsApp delivery confirmation
- Confirmation: confetti, pulse animation, share CTA, WhatsApp receipt

COMPOSE:
- Added WAHA env vars + qc-comms network for WhatsApp access
This commit is contained in:
2026-03-03 04:31:07 +08:00
parent 0236867c88
commit c6e7e4f01e
15 changed files with 1473 additions and 383 deletions

View File

@@ -0,0 +1,35 @@
import { NextRequest, NextResponse } from "next/server"
import { sendPledgeReceipt, sendPledgeReminder, getWhatsAppStatus } from "@/lib/whatsapp"
export async function POST(request: NextRequest) {
try {
const body = await request.json()
const { type, phone, data } = body
if (!phone) {
return NextResponse.json({ error: "Phone number required" }, { status: 400 })
}
let result
switch (type) {
case "receipt":
result = await sendPledgeReceipt(phone, data)
break
case "reminder":
result = await sendPledgeReminder(phone, data)
break
default:
return NextResponse.json({ error: "Unknown message type" }, { status: 400 })
}
return NextResponse.json(result)
} catch (error) {
console.error("WhatsApp send error:", error)
return NextResponse.json({ error: "Failed to send" }, { status: 500 })
}
}
export async function GET() {
const status = await getWhatsAppStatus()
return NextResponse.json(status)
}