Skip to content

Commit ae0a003

Browse files
authored
fix(console): fix the constant basic sku price on billing notification (#7830)
fix(console): dynamicly render the basic sku price should render the basic sku price dynamicly using the current SKU context
1 parent d523ba6 commit ae0a003

File tree

2 files changed

+4
-4
lines changed
  • packages/console/src

2 files changed

+4
-4
lines changed

packages/console/src/consts/subscriptions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export const proPlanAuditLogsRetentionDays = 14;
1010

1111
// TODO: currently we do not provide a good way to retrieve add-on items unit price in console, we hence manually defined the unit price here, will implement the API soon.
1212
/* === Add-on unit price (in USD) === */
13-
export const proPlanBasePrice = 16;
1413
export const resourceAddOnUnitPrice = 4;
1514
export const machineToMachineAddOnUnitPrice = 8;
1615
export const tenantMembersAddOnUnitPrice = 8;

packages/console/src/pages/TenantSettings/Subscription/CurrentPlan/AddOnUsageChangesNotification/index.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useContext } from 'react';
22
import { Trans, useTranslation } from 'react-i18next';
33

44
import { addOnPricingExplanationLink } from '@/consts/external-links';
5-
import { proPlanBasePrice } from '@/consts/subscriptions';
65
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
76
import InlineNotification from '@/ds-components/InlineNotification';
87
import TextLink from '@/ds-components/TextLink';
@@ -16,6 +15,7 @@ type Props = {
1615
function AddOnUsageChangesNotification({ className }: Props) {
1716
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
1817
const {
18+
currentSku: { unitPrice },
1919
currentSubscription: { planId, isEnterprisePlan },
2020
} = useContext(SubscriptionDataContext);
2121
const {
@@ -25,7 +25,8 @@ function AddOnUsageChangesNotification({ className }: Props) {
2525

2626
const isPaidTenant = isPaidPlan(planId, isEnterprisePlan);
2727

28-
if (!isPaidTenant || addOnChangesInCurrentCycleNoticeAcknowledged) {
28+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
29+
if (!isPaidTenant || addOnChangesInCurrentCycleNoticeAcknowledged || !unitPrice) {
2930
return null;
3031
}
3132

@@ -43,7 +44,7 @@ function AddOnUsageChangesNotification({ className }: Props) {
4344
}}
4445
>
4546
{t('subscription.usage.pricing.add_on_changes_in_current_cycle_notice', {
46-
price: proPlanBasePrice,
47+
price: unitPrice / 100,
4748
})}
4849
</Trans>
4950
</InlineNotification>

0 commit comments

Comments
 (0)