import { Label } from "@/components/ui/label" import { Input } from "@/components/ui/input" import { Switch } from "@/components/ui/switch" import { Checkbox } from "@/components/ui/checkbox" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { wordpressRoles } from "@/features/spam/email-verification/config" import { AbandonedCartSettings } from "../../types" interface AdvancedTabProps { settings: AbandonedCartSettings updateSettings: (updates: Partial) => void } const ORDER_STATUSES = [ { value: "pending", label: "Pending Payment" }, { value: "failed", label: "Failed" }, { value: "on-hold", label: "On Hold" }, ] as const export function AdvancedTab({ settings, updateSettings }: AdvancedTabProps) { const toggleOrderStatus = (status: string) => { const current = settings.unpaidOrderStatuses || [] updateSettings({ unpaidOrderStatuses: current.includes(status) ? current.filter((item) => item !== status) : [...current, status], }) } const toggleExcludeRole = (role: string) => { const current = settings.excludeRoles || [] updateSettings({ excludeRoles: current.includes(role) ? current.filter((item) => item !== role) : [...current, role], }) } return (
Unpaid Order Recovery Send payment reminders for pending, failed, or on-hold orders.
updateSettings({ recoverUnpaidOrders: checked })} />
{settings.recoverUnpaidOrders && ( <>
updateSettings({ unpaidOrderThreshold: parseInt(event.target.value) || 60 })} />
{ORDER_STATUSES.map((status) => (
toggleOrderStatus(status.value)} />
))}
)}
Admin Recovery Notification Notify the store team after a paid cart or unpaid order is recovered.
updateSettings({ adminNotifyOnRecovery: checked })} />
{settings.adminNotifyOnRecovery && (
updateSettings({ adminNotifyEmail: event.target.value })} placeholder="Defaults to the WordPress admin email" />
)}
Exclude Roles from Tracking Exclude staff or other internal roles from recovery tracking. {wordpressRoles.map((role) => (
toggleExcludeRole(role.value)} />
))}
Recovery Eligibility Only retain carts that meet your minimum value. updateSettings({ minCartValue: Math.max(0, parseFloat(event.target.value) || 0) })} />

Uses the store currency. Set to 0 to track every cart.

Abandonment Webhook Notify an endpoint when an eligible cart becomes abandoned.
updateSettings({ webhookUrl: event.target.value })} placeholder="https://automation.example.com/hooks/cart" />
updateSettings({ webhookSecret: event.target.value })} placeholder="Optional shared secret" />

Requests include the customer email, total, currency, and an HMAC signature when configured.

) }