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>
18 lines
525 B
TypeScript
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);
|
|
}
|