Skip to content

Commit 30c8bca

Browse files
authored
chore(clerk-js): Display free trial badge <PricingTable/> (#6656)
1 parent 977daa4 commit 30c8bca

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

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+
Display free trial badge `<PricingTable/>`.

integration/tests/pricing-table.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
299299

300300
// Verify the user is now shown as having an active free trial
301301
// The pricing table should show their current plan as active
302-
await u.po.pricingTable.waitToBeActive({ planSlug: 'trial' });
302+
await u.po.pricingTable.waitToBeFreeTrial({ planSlug: 'trial' });
303303

304304
await u.po.page.goToRelative('/user');
305305
await u.po.userProfile.waitForMounted();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ function Card(props: CardProps) {
184184
isCompact={isCompact}
185185
planPeriod={planPeriod}
186186
setPlanPeriod={setPlanPeriod}
187-
badge={showStatusRow ? <SubscriptionBadge subscription={subscription} /> : undefined}
187+
badge={
188+
showStatusRow ? (
189+
<SubscriptionBadge subscription={subscription.isFreeTrial ? { status: 'free_trial' } : subscription} />
190+
) : undefined
191+
}
188192
/>
189193
<Box
190194
elementDescriptor={descriptors.pricingTableCardBody}

packages/testing/src/playwright/unstable/page-objects/pricingTable.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export const createPricingTablePageObject = (testArgs: { page: EnhancedPage }) =
5959
waitToBeActive: async ({ planSlug }: { planSlug: string }) => {
6060
return locators.badge(planSlug).getByText('Active').waitFor({ state: 'visible' });
6161
},
62+
waitToBeFreeTrial: async ({ planSlug }: { planSlug: string }) => {
63+
return locators.badge(planSlug).getByText('Free trial').waitFor({ state: 'visible' });
64+
},
6265
getPlanCardCTA: ({ planSlug }: { planSlug: string }) => {
6366
return locators.footer(planSlug).getByRole('button', {
6467
name: /get|switch|subscribe/i,

0 commit comments

Comments
 (0)