新功能(#113): 新增促销管理后台页面
PR Check / Lint, Check, Test and Build (push) Has been cancelled

This commit is contained in:
2026-05-29 00:34:37 -07:00
parent 2a3d5a3234
commit c46944aae1
17 changed files with 1733 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { unitConversion } from "@workspace/ui/utils/unit-conversions";
export const promoRuleTypes: API.PromoRuleType[] = [
"inactive_user",
"new_user",
"campaign",
];
export function formatCurrency(value?: number) {
if (typeof value !== "number") return "--";
return `$${unitConversion("centsToDollars", value)}`;
}
export function parseOptionalNumber(value?: string) {
if (!value) return;
const parsed = Number(value);
return Number.isFinite(parsed) ? parsed : undefined;
}
export function getSubscribeUnitPrice(subscribe?: API.SubscribeItem) {
return typeof subscribe?.unit_price === "number" ? subscribe.unit_price : 0;
}