Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ui/AicNetCostInfoTip.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InfoTip } from '../InfoTip'

const AIC_NET_COST_INFO = 'All values are provided without any additional negotiated discounts applied.'
const AIC_NET_COST_INFO = 'All values are provided without any existing discounts.'

export function AicNetCostInfoTip() {
return (
Expand Down
16 changes: 8 additions & 8 deletions src/components/ui/BillingTotalsCards.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { appLinks } from '../../config/links'
import type { IndividualPlanUpgradeRecommendation } from '../../utils/individualPlanUpgrade'
import { formatAic, formatUsd } from '../../utils/format'
import { NegotiatedDiscountDisclaimer } from './NegotiatedDiscountDisclaimer'
import { ExistingDiscountDisclaimer } from './ExistingDiscountDisclaimer'
import { PromotionalDataDisclaimer } from './PromotionalDataDisclaimer'

export type BillingTotalsCardsProps = {
Expand All @@ -18,7 +18,7 @@ export type BillingTotalsCardsProps = {
business: number
enterprise: number
}
showNegotiatedDiscountDisclaimer?: boolean
showExistingDiscountDisclaimer?: boolean
showPromotionalDataDisclaimer?: boolean
upgradeRecommendation?: IndividualPlanUpgradeRecommendation | null
className?: string
Expand All @@ -35,7 +35,7 @@ export function BillingTotalsCards({
aicQuantity,
licenseAmount,
licenseSeatCounts,
showNegotiatedDiscountDisclaimer = false,
showExistingDiscountDisclaimer = false,
showPromotionalDataDisclaimer = false,
upgradeRecommendation = null,
className = '',
Expand Down Expand Up @@ -89,15 +89,15 @@ export function BillingTotalsCards({
<span>{formatUsd(licenseAmount)}</span>
</div>
)}
{(licenseAmount !== undefined || showNegotiatedDiscountDisclaimer) && (
{(licenseAmount !== undefined || showExistingDiscountDisclaimer) && (
<div className="pt-[6px] border-t border-border-default">
{licenseAmount !== undefined && (
<div className="flex justify-between items-center text-[13px] text-fg-default tabular-nums font-semibold">
<span>Total (license + overages)</span>
<span>{formatUsd(pruTotalAmount)}</span>
</div>
)}
{showNegotiatedDiscountDisclaimer && <NegotiatedDiscountDisclaimer />}
{showExistingDiscountDisclaimer && <ExistingDiscountDisclaimer />}
</div>
)}
</div>
Expand Down Expand Up @@ -128,17 +128,17 @@ export function BillingTotalsCards({
<span>{formatUsd(licenseAmount)}</span>
</div>
)}
{(licenseAmount !== undefined || showNegotiatedDiscountDisclaimer || showPromotionalDataDisclaimer) && (
{(licenseAmount !== undefined || showExistingDiscountDisclaimer || showPromotionalDataDisclaimer) && (
<div className="pt-[6px] border-t border-border-default">
{licenseAmount !== undefined && (
<div className="flex justify-between items-center text-[13px] text-fg-default tabular-nums font-semibold">
<span>Total (license + additional usage)</span>
<span>{formatUsd(aicTotalAmount)}</span>
</div>
)}
{showNegotiatedDiscountDisclaimer && (
{showExistingDiscountDisclaimer && (
<>
<NegotiatedDiscountDisclaimer />
<ExistingDiscountDisclaimer />
<PromotionalDataDisclaimer scope="organization" />
</>
)}
Expand Down
13 changes: 13 additions & 0 deletions src/components/ui/ExistingDiscountDisclaimer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const EXISTING_DISCOUNT_DISCLAIMER = 'All values are provided without any existing discounts.'

type ExistingDiscountDisclaimerProps = {
className?: string
}

export function ExistingDiscountDisclaimer({ className = '' }: ExistingDiscountDisclaimerProps) {
return (
<p className={`m-0 mt-1 text-[12px] text-fg-muted leading-normal ${className}`.trim()}>
{EXISTING_DISCOUNT_DISCLAIMER}
</p>
)
}
13 changes: 0 additions & 13 deletions src/components/ui/NegotiatedDiscountDisclaimer.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/ui/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export { BillingTotalsCards } from './BillingTotalsCards'
export type { BillingTotalsCardsProps } from './BillingTotalsCards'
export { BillingProjectionDisclaimer } from './BillingProjectionDisclaimer'
export { AicNetCostInfoTip } from './AicNetCostInfoTip'
export { NegotiatedDiscountDisclaimer, NEGOTIATED_DISCOUNT_DISCLAIMER } from './NegotiatedDiscountDisclaimer'
export { ExistingDiscountDisclaimer, EXISTING_DISCOUNT_DISCLAIMER } from './ExistingDiscountDisclaimer'
export { PromotionalDataDisclaimer } from './PromotionalDataDisclaimer'
6 changes: 3 additions & 3 deletions src/views/CostCentersView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useMemo, useState } from 'react'
import type { ChangeEvent } from 'react'
import { BillingProjectionDisclaimer, NegotiatedDiscountDisclaimer } from '../components/ui'
import { BillingProjectionDisclaimer, ExistingDiscountDisclaimer } from '../components/ui'
import { th, thNum, td, tdNum } from '../components/ui/tableStyles'
import { appLinks } from '../config/links'
import type { CostCenterResult, CostCenterUserTotals, CostTotals } from '../pipeline/aggregators/costCenterAggregator'
Expand Down Expand Up @@ -145,7 +145,7 @@ export function CostCentersView({ data, rangeStart }: { data: CostCenterResult;
<span>Overages</span>
<span>{formatUsd(totals.netAmount)}</span>
</div>
<NegotiatedDiscountDisclaimer />
<ExistingDiscountDisclaimer />
</div>
</div>
<div className="bg-bg-default border border-border-default rounded-md text-center py-7 px-5">
Expand All @@ -166,7 +166,7 @@ export function CostCentersView({ data, rangeStart }: { data: CostCenterResult;
<span>Additional usage</span>
<span>{formatUsd(totals.aicNetAmount)}</span>
</div>
<NegotiatedDiscountDisclaimer />
<ExistingDiscountDisclaimer />
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/CostManagementView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export function CostManagementView({
aicQuantity={currentAicQuantity}
licenseAmount={licenseAmount}
licenseSeatCounts={licenseSeatCounts}
showNegotiatedDiscountDisclaimer={!isIndividualReport}
showExistingDiscountDisclaimer={!isIndividualReport}
showPromotionalDataDisclaimer={isIndividualReport}
upgradeRecommendation={upgradeRecommendation}
/>
Expand Down
8 changes: 4 additions & 4 deletions src/views/ModelsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState, useMemo } from 'react'
import { InfoIcon } from '@primer/octicons-react'
import type { ModelUsageResult, ModelDailyUsageData, ModelUsageTotals } from '../pipeline/aggregators/modelUsageAggregator'
import { DualAxisLineChart, MultiSeriesStackedBarChart } from '../components'
import { BillingProjectionDisclaimer, NegotiatedDiscountDisclaimer, PromotionalDataDisclaimer } from '../components/ui'
import { BillingProjectionDisclaimer, ExistingDiscountDisclaimer, PromotionalDataDisclaimer } from '../components/ui'
import { th, thNum, td, tdNum } from '../components/ui/tableStyles'
import { calculateAicDiscountAmount, calculateSavingsDifference } from '../utils/billingComparison'
import { fillDataForRange } from '../utils/fillDataForRange'
Expand Down Expand Up @@ -122,7 +122,7 @@ export function ModelsView({ modelUsage, isIndividualReport, rangeStart, rangeEn
const periodLabel = rangeStart
? new Date(rangeStart + 'T00:00:00').toLocaleString('en-US', { month: 'long', year: 'numeric' })
: null
const showNegotiatedDiscountDisclaimer = !isIndividualReport
const showExistingDiscountDisclaimer = !isIndividualReport

return (
<section className="flex flex-col gap-3" aria-label="Models">
Expand Down Expand Up @@ -220,7 +220,7 @@ export function ModelsView({ modelUsage, isIndividualReport, rangeStart, rangeEn
<span>Overages</span>
<span>{formatUsd(selectedModelTotals.netAmount)}</span>
</div>
{showNegotiatedDiscountDisclaimer && <NegotiatedDiscountDisclaimer />}
{showExistingDiscountDisclaimer && <ExistingDiscountDisclaimer />}
</div>
</div>
<div className="bg-bg-default border border-border-default rounded-md px-5 py-4 text-center py-7">
Expand All @@ -241,7 +241,7 @@ export function ModelsView({ modelUsage, isIndividualReport, rangeStart, rangeEn
<span>Additional usage</span>
<span>{formatUsd(selectedModelAicNetAmount)}</span>
</div>
{showNegotiatedDiscountDisclaimer ? <NegotiatedDiscountDisclaimer /> : <PromotionalDataDisclaimer />}
{showExistingDiscountDisclaimer ? <ExistingDiscountDisclaimer /> : <PromotionalDataDisclaimer />}
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/views/OrganizationsView.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useMemo, useState } from 'react'
import type { ChangeEvent } from 'react'
import { BillingProjectionDisclaimer, NegotiatedDiscountDisclaimer } from '../components/ui'
import { BillingProjectionDisclaimer, ExistingDiscountDisclaimer } from '../components/ui'
import { th, thNum, td, tdNum } from '../components/ui/tableStyles'
import { appLinks } from '../config/links'
import type { OrganizationResult, OrgTotals, OrgUserTotals } from '../pipeline/aggregators/organizationAggregator'
Expand Down Expand Up @@ -144,7 +144,7 @@ export function OrganizationsView({ data, rangeStart }: { data: OrganizationResu
<span>Overages</span>
<span>{formatUsd(totals.netAmount)}</span>
</div>
<NegotiatedDiscountDisclaimer />
<ExistingDiscountDisclaimer />
</div>
</div>
<div className="bg-bg-default border border-border-default rounded-md text-center py-7 px-5">
Expand All @@ -165,7 +165,7 @@ export function OrganizationsView({ data, rangeStart }: { data: OrganizationResu
<span>Additional usage</span>
<span>{formatUsd(totals.aicNetAmount)}</span>
</div>
<NegotiatedDiscountDisclaimer />
<ExistingDiscountDisclaimer />
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/views/OverviewView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function OverviewView({
aicQuantity={overviewTotals.aicQuantity}
licenseAmount={licenseAmount}
licenseSeatCounts={licenseSeatCounts}
showNegotiatedDiscountDisclaimer={reportPlanScope !== 'individual'}
showExistingDiscountDisclaimer={reportPlanScope !== 'individual'}
showPromotionalDataDisclaimer={reportPlanScope === 'individual'}
upgradeRecommendation={upgradeRecommendation}
className="mb-3"
Expand Down
10 changes: 5 additions & 5 deletions src/views/UserDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { calculateAicDiscountAmount, calculateSavingsDifference } from '../utils
import { fillDataForRange } from '../utils/fillDataForRange'
import { formatAic } from '../utils/format'
import { getUserSpendSegmentLabel } from '../utils/userSpendSegments'
import { BillingProjectionDisclaimer, NegotiatedDiscountDisclaimer, PromotionalDataDisclaimer } from '../components/ui'
import { BillingProjectionDisclaimer, ExistingDiscountDisclaimer, PromotionalDataDisclaimer } from '../components/ui'
import { th, thNum, td, tdNum } from '../components/ui/tableStyles'

type DailySummaryModelRow = {
Expand Down Expand Up @@ -179,8 +179,8 @@ export function UserDetailsView({
const aicDiscountAmount = user ? calculateAicDiscountAmount(user.totals.aicGrossAmount, user.totals.aicNetAmount) : 0
const savings = user ? calculateSavingsDifference(user.totals.netAmount, user.totals.aicNetAmount) : 0
const planLabel = user ? getPlanLabel(user.totalMonthlyQuota, reportPlanScope) : null
const showNegotiatedDiscountDisclaimer = reportPlanScope !== 'individual'
const spendSegmentLabel = user && showNegotiatedDiscountDisclaimer ? getUserSpendSegmentLabel(user.spendSegment) : null
const showExistingDiscountDisclaimer = reportPlanScope !== 'individual'
const spendSegmentLabel = user && showExistingDiscountDisclaimer ? getUserSpendSegmentLabel(user.spendSegment) : null

if (!user) {
return (
Expand Down Expand Up @@ -271,7 +271,7 @@ export function UserDetailsView({
<span>Overages</span>
<span>{formatCost(user.totals.netAmount)}</span>
</div>
{showNegotiatedDiscountDisclaimer && <NegotiatedDiscountDisclaimer />}
{showExistingDiscountDisclaimer && <ExistingDiscountDisclaimer />}
</div>
</div>
<div className="bg-bg-default border border-border-default rounded-md px-5 py-7 text-center">
Expand All @@ -292,7 +292,7 @@ export function UserDetailsView({
<span>Additional usage</span>
<span>{formatCost(user.totals.aicNetAmount)}</span>
</div>
{showNegotiatedDiscountDisclaimer ? <NegotiatedDiscountDisclaimer /> : <PromotionalDataDisclaimer />}
{showExistingDiscountDisclaimer ? <ExistingDiscountDisclaimer /> : <PromotionalDataDisclaimer />}
</div>
</div>
</div>
Expand Down