Files
beenvoice-app/lib/invoice-business.ts
soconnorandCursor 6762a9bff3 Move production to beenvoice.app with migrated accounts, refreshed auth and timer UX, and expanded invoice flows.
Official URL migration preserves sessions, shortcuts prefs, and last clock-in client; auth screens match web with legal links; time clock and invoice editor/send flows are updated for the new domain and UI patterns.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 03:40:48 -04:00

18 lines
525 B
TypeScript

type BusinessOption = {
id: string;
isDefault?: boolean | null;
};
export function pickDefaultBusinessId(businesses: BusinessOption[] | undefined): string {
if (!businesses?.length) return "";
return businesses.find((business) => business.isDefault)?.id ?? businesses[0]!.id;
}
export function resolveInvoiceBusinessId(
explicitId: string | null | undefined,
businesses: BusinessOption[] | undefined,
): string {
if (explicitId?.trim()) return explicitId.trim();
return pickDefaultBusinessId(businesses);
}