@@ -46,17 +46,6 @@ export function shouldResetAlertsOnLimitChange(
4646 return isPercentageAlertMode ( previousMode ) !== isPercentageAlertMode ( nextMode ) ;
4747}
4848
49- /** Configured billing limit mode before a save; null when billing limit was never configured. */
50- function getPreviousBillingLimitModeForAlertSync (
51- billingLimit : BillingLimitResult
52- ) : BillingLimitMode | null {
53- if ( ! billingLimit . isConfigured ) {
54- return null ;
55- }
56-
57- return billingLimit . mode ;
58- }
59-
6049export function hasConfiguredAlerts (
6150 alerts : BillingAlertsFormData ,
6251 billingLimit : BillingLimitResult ,
@@ -67,10 +56,6 @@ export function hasConfiguredAlerts(
6756 return storedAlertsToThresholds ( alerts , mode , effectiveLimitCents , planLimitCents ) . length > 0 ;
6857}
6958
70- function hasSavedAlertThresholds ( alerts : BillingAlertsFormData ) : boolean {
71- return alerts . alertLevels . length > 0 ;
72- }
73-
7459/** Saved thresholds that would be cleared when the billing limit alert format changes. */
7560export function hadSavedAlertsToClearOnLimitChange (
7661 alerts : BillingAlertsFormData ,
@@ -235,33 +220,6 @@ export function isLegacyDollarAmountField(
235220
236221 return rawAmount === planDollars || rawAmount === effectiveDollars ;
237222}
238- function isAbsoluteSavedAlerts ( alerts : BillingAlertsFormData ) : boolean {
239- return getSavedAlertAmountCents ( alerts ) === ABSOLUTE_ALERT_BASE_CENTS ;
240- }
241-
242- /** Build a cleaned alerts payload when saving billing limits in the same alert format. */
243- function buildCleanedAlertsPayloadForLimitSave (
244- alerts : BillingAlertsFormData ,
245- nextMode : BillingLimitMode ,
246- effectiveLimitCents : number ,
247- planLimitCents : number
248- ) : { amount : number ; alertLevels : number [ ] ; emails : string [ ] } | null {
249- if ( alerts . alertLevels . length === 0 ) {
250- return null ;
251- }
252-
253- const thresholds = storedAlertsToThresholds (
254- alerts ,
255- nextMode ,
256- effectiveLimitCents ,
257- planLimitCents
258- ) ;
259-
260- return {
261- emails : alerts . emails ,
262- ...thresholdsToAlertPayload ( thresholds , nextMode , effectiveLimitCents ) ,
263- } ;
264- }
265223
266224/** Convert stored percentage alert levels to UI percent values (10, 50, 80). */
267225export function percentageAlertLevelsToUiThresholds ( levels : number [ ] ) : number [ ] {
@@ -386,10 +344,6 @@ export function thresholdsToAlertPayload(
386344 } ;
387345}
388346
389- function isEmptyThreshold ( value : number ) : boolean {
390- return ! Number . isFinite ( value ) || value <= 0 ;
391- }
392-
393347export function previewDollarAmountForPercent (
394348 percent : number ,
395349 effectiveLimitCents : number
0 commit comments