domaino/app-admin/src/lib/customers.ts
agent df840b7fd7 Admin: bundles under Services & products, Vouchers & codes page
Bundles are edited with their parts (service at a length, or product,
× count), price and validity. /passes lists codes with used/held/left and
each part's share of the price; codes can be voided, reactivated, given a
new expiry, or issued without a purchase. Orders show codes bought and
bookings paid with a code; the customer page lists codes and erasure
covers them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
2026-10-25 21:39:51 +00:00

33 lines
1.1 KiB
TypeScript

// Shapes returned by PocketBase's /api/privacy routes (pocketbase/pb_hooks/privacy/lib.js).
export type CustomerSummary = {
email: string;
name: string;
phone: string;
orders: number;
/** Checkouts started but not paid for. */
unpaid: number;
lastSeen: string;
};
export type CustomerDetails = { name?: string; email?: string; phone?: string; notes?: string };
/** Everything stored about one customer; also the GDPR export file. */
export type CustomerData = {
email: string;
exportedAt: string;
orders: {
id: string;
created: string;
status: string;
total: number;
email: string;
customerDetails: CustomerDetails;
customerEmailSentAt: string;
clientEmailSentAt: string;
lines: { name: string; quantity: number; price: number; start: string }[];
}[];
unpaidBaskets: { id: string; updated: string; status: string; customerDetails: CustomerDetails }[];
/** Bundle/voucher codes bought with this email, and who they're for. */
codes: { code: string; name: string; created: string; expiresAt: string; status: string; recipientName: string; message: string }[];
};