feat: add app-owned Copilot and Grok subscription connections
This commit is contained in:
@@ -8,9 +8,9 @@ export function formatUsd(c: number): string {
|
||||
return c >= 1 ? `$${c.toFixed(2)}` : `$${c.toFixed(4)}`;
|
||||
}
|
||||
|
||||
export function planCostLabel(dollars: number | null, subscription: boolean, format = formatUsd): string {
|
||||
if (subscription) return dollars === null ? "ChatGPT plan" : `${format(dollars)} API + ChatGPT plan`;
|
||||
return dollars === null ? "—" : format(dollars);
|
||||
export function planCostLabel(dollars: number | null, subscription: boolean | string | readonly string[] | undefined, format = formatUsd): string {
|
||||
const labels = subscription === true ? ["ChatGPT"] : typeof subscription === "string" ? [subscription] : Array.isArray(subscription) ? [...new Set(subscription)] : [];
|
||||
return [...(dollars === null ? [] : [format(dollars)]), ...labels].join(" + ") || "—";
|
||||
}
|
||||
|
||||
/** 38000 → "38k", 1234567 → "1.2M" — trimmed, never "38.0k". */
|
||||
|
||||
Reference in New Issue
Block a user