@@ -18,7 +18,7 @@ export type BillingLimitMode = "plan" | "custom" | "none";
1818
1919export function getBillingLimitMode ( billingLimit : BillingLimitResult ) : BillingLimitMode {
2020 if ( ! billingLimit . isConfigured ) {
21- return "plan " ;
21+ return "none " ;
2222 }
2323 return billingLimit . mode ;
2424}
@@ -240,14 +240,16 @@ export function normalizeBillingAlertsFromApi(apiAlerts: {
240240 // Platform API stores amount in cents.
241241 let amountDollars = rawAmount / 100 ;
242242
243- // Legacy percentage alerts sometimes stored plan dollars directly (e.g. 100 for $100).
244- // Never apply to absolute dollar alerts — those use a fixed $1 base (100 cents).
243+ // Legacy percentage alerts sometimes stored plan dollars directly (e.g. 100 for $100)
244+ // with whole-number percents (10, 50, 80). New saves store cents and fractional levels
245+ // (0.75, 0.9) via thresholdsToAlertPayload — never treat those as legacy dollars.
245246 if (
246247 rawAmount !== ABSOLUTE_ALERT_BASE_CENTS &&
247248 Number . isFinite ( rawAmount ) &&
248249 rawAmount >= 10 &&
249250 rawAmount / 100 < 10 &&
250- alertLevels . length > 0
251+ alertLevels . length > 0 &&
252+ ! usesFractionAlertLevelFormat ( alertLevels )
251253 ) {
252254 amountDollars = rawAmount ;
253255 }
@@ -311,11 +313,8 @@ export function storedAlertsToThresholds(
311313 return [ ] ;
312314 }
313315
314- // Legacy percentage alerts keep their saved base amount even if billing limit changed.
315- if (
316- percentageAlertAmountMatches ( amountCents , effectiveLimitCents , planLimitCents ) ||
317- amountCents > 0
318- ) {
316+ // Saved percentage alerts keep their thresholds whenever a positive base amount is stored.
317+ if ( amountCents > 0 ) {
319318 return uiThresholds . slice ( 0 , MAX_PERCENTAGE_ALERTS ) ;
320319 }
321320
0 commit comments