@@ -70,10 +70,16 @@ export interface PlannedTab {
|
||||
export interface ReminderCandidate {
|
||||
tabId: string;
|
||||
customerName: string;
|
||||
email: string;
|
||||
/** Null when the customer has no email address on file */
|
||||
email: string | null;
|
||||
amountInCents: number;
|
||||
itemCount: number;
|
||||
items: TabLine[] | null;
|
||||
reminderCount: number;
|
||||
lastReminderAt: string | null;
|
||||
nextEligibleAt: string | null;
|
||||
/** Has an email and is past the cooldown */
|
||||
eligible: boolean;
|
||||
}
|
||||
|
||||
export interface Reminder {
|
||||
@@ -274,11 +280,16 @@ export const plannedTabsApi = {
|
||||
// Reminders API
|
||||
export const remindersApi = {
|
||||
candidates: (venueId: string) =>
|
||||
api<{ candidates: ReminderCandidate[] }>(`/venues/${venueId}/reminders/candidates`),
|
||||
send: (venueId: string) =>
|
||||
api<{ sent: number; total: number; errors?: { customerName: string; error: string }[] }>(`/venues/${venueId}/reminders/send`, { method: 'POST' }),
|
||||
history: (venueId: string) =>
|
||||
api<{ reminders: Reminder[] }>(`/venues/${venueId}/reminders`),
|
||||
api<{ candidates: ReminderCandidate[]; cooldownDays: number }>(`/venues/${venueId}/reminders/candidates`),
|
||||
send: (venueId: string, tabIds: string[]) =>
|
||||
api<{ sent: number; total: number; errors?: { customerName: string; error: string }[] }>(`/venues/${venueId}/reminders/send`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ tabIds }),
|
||||
}),
|
||||
history: (venueId: string, customerName?: string) =>
|
||||
api<{ reminders: Reminder[] }>(
|
||||
`/venues/${venueId}/reminders${customerName ? `?customerName=${encodeURIComponent(customerName)}` : ''}`,
|
||||
),
|
||||
sendTest: (venueId: string, plannedTabId: string) =>
|
||||
api<{ ok: boolean; email: string; customerName: string }>(`/venues/${venueId}/reminders/test/${plannedTabId}`, { method: 'POST' }),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user