feat(billing): add formula A/B admin UI and subscription renew status

Expose dual metering formula editing with batch user assignment, show
auto-renew and pending-recharge states in subscriptions, and document
billing acceptance checks for production rollout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-22 08:45:43 +08:00
parent a503fa9cbe
commit f6bb02254e
8 changed files with 503 additions and 171 deletions
+15
View File
@@ -18,6 +18,7 @@ export type PortalUser = {
balanceCents: number;
totalCreditCents?: number;
tokensUsed: number;
billingFormula?: 'A' | 'B';
spaceQuotaBytes?: number;
spaceUsedBytes?: number;
spaceReservedBytes?: number;
@@ -44,6 +45,7 @@ export type AuthStatus = {
};
export type AdminUserRow = PortalUser & {
billingFormula?: 'A' | 'B';
createdAt: number;
updatedAt: number;
};
@@ -676,8 +678,20 @@ export type BillingAdminConfig = {
costEstimateOutputUsdPer1M: number;
};
export type BillingFormulaKey = 'A' | 'B';
export type BillingFormulaMeta = {
updatedAt: number | null;
updatedBy: string | null;
source?: string;
};
export type BillingAdminConfigResponse = {
config: BillingAdminConfig;
formulas?: Record<BillingFormulaKey, BillingAdminConfig>;
formulaMeta?: Record<BillingFormulaKey, BillingFormulaMeta>;
activeFormula?: BillingFormulaKey;
defaultFormula?: BillingFormulaKey;
updatedAt: number | null;
updatedBy: string | null;
source?: string;
@@ -722,6 +736,7 @@ export type AdminSubscription = {
periodImagesLimit: number;
periodImagesUsed: number;
periodImagesBonus?: number;
autoRenew?: boolean;
note: string | null;
createdAt: number;
};