Skip to content

Commit aaf8cfe

Browse files
authored
fix(clerk-js): Only render toggle if plan is not the default plan (#8031)
1 parent adb2a14 commit aaf8cfe

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

.changeset/bright-brooms-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Fix issue where free plans had a monthly/annual toggle.

packages/clerk-js/src/ui/components/Plans/PlanDetails.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ const Header = React.forwardRef<HTMLDivElement, HeaderProps>((props, ref) => {
325325
</>
326326
</Flex>
327327

328-
{plan.annualMonthlyFee ? (
328+
{plan.annualMonthlyFee && !plan.isDefault ? (
329329
<Box
330330
elementDescriptor={descriptors.planDetailPeriodToggle}
331331
sx={t => ({

packages/clerk-js/src/ui/components/PricingTable/PricingTableDefault.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ const CardHeader = React.forwardRef<HTMLDivElement, CardHeaderProps>((props, ref
381381
) : null}
382382
</Flex>
383383

384-
{planSupportsAnnual && setPlanPeriod ? (
384+
{planSupportsAnnual && !plan.isDefault && setPlanPeriod ? (
385385
<Box
386386
elementDescriptor={descriptors.pricingTableCardPeriodToggle}
387387
sx={t => ({

packages/clerk-js/src/ui/contexts/components/Plans.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export const usePlansContext = () => {
215215
const subscription =
216216
sub ?? (plan ? activeOrUpcomingSubscriptionWithPlanPeriod(plan, selectedPlanPeriod) : undefined);
217217
let _selectedPlanPeriod = selectedPlanPeriod;
218-
const isEligibleForSwitchToAnnual = Boolean(plan?.annualMonthlyFee);
218+
const isEligibleForSwitchToAnnual = Boolean(plan?.annualMonthlyFee && !plan.isDefault);
219219

220220
if (_selectedPlanPeriod === 'annual' && !isEligibleForSwitchToAnnual) {
221221
_selectedPlanPeriod = 'month';

0 commit comments

Comments
 (0)