diff --git a/sdks/js/packages/core/react/components/organization/billing/upcoming-billing-cycle.tsx b/sdks/js/packages/core/react/components/organization/billing/upcoming-billing-cycle.tsx index 3d91bbfb9..7ca2e30a0 100644 --- a/sdks/js/packages/core/react/components/organization/billing/upcoming-billing-cycle.tsx +++ b/sdks/js/packages/core/react/components/organization/billing/upcoming-billing-cycle.tsx @@ -10,6 +10,7 @@ import line from '~/react/assets/line.svg'; import Amount from '../../helpers/Amount'; import dayjs from 'dayjs'; import { InfoCircledIcon } from '@radix-ui/react-icons'; +import { IntervalKeys, IntervalLabelMap } from '~/src/types'; function LabeledBillingData({ label, @@ -140,7 +141,8 @@ export const UpcomingBillingCycle = () => { } }, [client, billingAccount?.org_id, billingAccount?.id]); - const planName = plan?.title; + const interval = IntervalLabelMap[plan?.interval as IntervalKeys]; + const planName = `${plan?.title} (${interval})`; const planInfo = activeSubscription ? { @@ -169,9 +171,11 @@ export const UpcomingBillingCycle = () => { isMemberCountLoading || isPlansLoading; + const due_date = upcomingInvoice?.due_date || upcomingInvoice?.period_end_at; + return isLoading ? ( - ) : upcomingInvoice && upcomingInvoice?.due_date ? ( + ) : due_date ? ( { {/* @ts-ignore */} line diff --git a/sdks/js/packages/core/src/types.ts b/sdks/js/packages/core/src/types.ts index 56b2e3e9c..fdef34029 100644 --- a/sdks/js/packages/core/src/types.ts +++ b/sdks/js/packages/core/src/types.ts @@ -66,6 +66,7 @@ export interface FrontierProviderProps { } export const IntervalLabelMap = { + daily: 'Daily', month: 'Monthly', year: 'Yearly' } as const;