diff --git a/packages/twenty-front/src/modules/billing/components/SubscriptionPrice.tsx b/packages/twenty-front/src/modules/billing/components/SubscriptionPrice.tsx index bfe183ded5..f2eaa95eb7 100644 --- a/packages/twenty-front/src/modules/billing/components/SubscriptionPrice.tsx +++ b/packages/twenty-front/src/modules/billing/components/SubscriptionPrice.tsx @@ -20,10 +20,20 @@ const StyledPriceUnitSpan = styled.span` font-weight: ${({ theme }) => theme.font.weight.medium}; `; +const formatYearlyPriceToMonthly = (price: number): number => { + const monthlyPrice = price / 12; + + return Number.isInteger(monthlyPrice) + ? monthlyPrice + : Number(monthlyPrice.toFixed(2)); +}; + export const SubscriptionPrice = ({ type, price }: SubscriptionPriceProps) => { const { t } = useLingui(); const pricePerSeat = - type === SubscriptionInterval.Year ? (price / 12).toFixed(2) : price; + type === SubscriptionInterval.Year + ? formatYearlyPriceToMonthly(price) + : price; let priceUnit = ''; switch (type) { diff --git a/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx b/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx index d37ef5b2cc..a227986e43 100644 --- a/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx +++ b/packages/twenty-front/src/pages/onboarding/internal/ChooseYourPlanContent.tsx @@ -6,11 +6,14 @@ import { billingCheckoutSessionState } from '@/auth/states/billingCheckoutSessio import { SubscriptionBenefit } from '@/billing/components/SubscriptionBenefit'; import { SubscriptionPrice } from '@/billing/components/SubscriptionPrice'; import { TrialCard } from '@/billing/components/TrialCard'; +import { useBaseLicensedPriceByPlanKeyAndInterval } from '@/billing/hooks/useBaseLicensedPriceByPlanKeyAndInterval'; +import { useBaseProductByPlanKey } from '@/billing/hooks/useBaseProductByPlanKey'; import { useHandleCheckoutSession } from '@/billing/hooks/useHandleCheckoutSession'; import { calendarBookingPageIdState } from '@/client-config/states/calendarBookingPageIdState'; import styled from '@emotion/styled'; import { Trans, useLingui } from '@lingui/react/macro'; import { useRecoilState, useRecoilValue } from 'recoil'; +import { AppPath } from 'twenty-shared/types'; import { isDefined } from 'twenty-shared/utils'; import { Loader } from 'twenty-ui/feedback'; import { CardPicker, MainButton } from 'twenty-ui/input'; @@ -21,9 +24,6 @@ import { } from 'twenty-ui/navigation'; import { BillingPlanKey } from '~/generated-metadata/graphql'; import { type Billing } from '~/generated/graphql'; -import { AppPath } from 'twenty-shared/types'; -import { useBaseProductByPlanKey } from '@/billing/hooks/useBaseProductByPlanKey'; -import { useBaseLicensedPriceByPlanKeyAndInterval } from '@/billing/hooks/useBaseLicensedPriceByPlanKeyAndInterval'; const StyledSubscriptionContainer = styled.div<{ withLongerMarginBottom: boolean;