@@ -18,6 +18,7 @@ import { ProductUsageAggregator, type ProductUsageResult } from './pipeline/aggr
1818import { CostCenterAggregator , type CostCenterResult } from './pipeline/aggregators/costCenterAggregator'
1919import { OrganizationAggregator , type OrganizationResult } from './pipeline/aggregators/organizationAggregator'
2020import { UserUsageAggregator , type UserUsageResult } from './pipeline/aggregators/userUsageAggregator'
21+ import { getMonthlyAicEntitlements } from './pipeline/aicEntitlements'
2122import { runPipeline } from './pipeline/runPipeline'
2223import { fillDataForRange } from './utils/fillDataForRange'
2324import { formatAic , formatUsd } from './utils/format'
@@ -37,19 +38,6 @@ function createEmptyDailyUsage(date: string): DailyUsageData {
3738 }
3839}
3940
40- // Current pooled AI Credits estimate based on Copilot plan assumptions in the billing export:
41- // quota >= 300 => 3,000 included credits, quota >= 1,000 => 7,000 included credits.
42- const INCLUDED_AIC_BY_MONTHLY_QUOTA = [
43- { minimumQuota : 1000 , includedCredits : 7000 } ,
44- { minimumQuota : 300 , includedCredits : 3000 } ,
45- ] as const
46-
47- function getIncludedAicCredits ( totalMonthlyQuota : number ) : number {
48- return INCLUDED_AIC_BY_MONTHLY_QUOTA . find ( ( plan ) => totalMonthlyQuota >= plan . minimumQuota ) ?. includedCredits ?? 0
49- }
50-
51-
52-
5341function App ( ) {
5442 const [ status , setStatus ] = useState < Status > ( 'idle' )
5543 const [ quickStats , setQuickStats ] = useState < QuickStatsResult | null > ( null )
@@ -200,7 +188,7 @@ function App() {
200188 { requests : 0 , aicQuantity : 0 , grossAmount : 0 , aicGrossAmount : 0 , aicNetAmount : 0 , discountAmount : 0 , netAmount : 0 } ,
201189 )
202190
203- const pooledAicCredits = ( userUsage ?. users ?? [ ] ) . reduce ( ( sum , user ) => sum + getIncludedAicCredits ( user . totalMonthlyQuota ) , 0 )
191+ const pooledAicCredits = ( userUsage ?. users ?? [ ] ) . reduce ( ( sum , user ) => sum + getMonthlyAicEntitlements ( user . totalMonthlyQuota ) , 0 )
204192
205193 const aicDiscountRate =
206194 overviewTotals . aicQuantity > 0
0 commit comments