Skip to content

Commit 614649a

Browse files
MananTankjnsdls
andcommitted
[Dsahboard] Feature: Billing V2 UI changes (#5436)
Co-authored-by: Jonas Daniels <[email protected]>
1 parent 62b734c commit 614649a

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

apps/dashboard/src/@/api/team.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export type Team = {
1616
billingPlan: "pro" | "growth" | "free" | "starter";
1717
billingStatus: "validPayment" | (string & {}) | null;
1818
billingEmail: string | null;
19+
growthTrialEligible: boolean | null;
1920
};
2021

2122
export async function getTeamBySlug(slug: string) {

apps/dashboard/src/@/constants/env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export function getAbsoluteUrlFromPath(path: string) {
3838
const url = new URL(
3939
isProd
4040
? "https://thirdweb.com"
41-
: process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL || "https://thirdweb-dev.com",
41+
: `https://${process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL}` ||
42+
"https://thirdweb-dev.com",
4243
);
4344

4445
url.pathname = path;

apps/dashboard/src/components/settings/Account/Billing/Pricing.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ type CtaLink = {
2020
export const BillingPricing: React.FC<BillingPricingProps> = ({
2121
team,
2222
trialPeriodEndedAt,
23-
canTrialGrowth,
2423
}) => {
2524
const validTeamPlan = getValidTeamPlan(team);
2625
const starterPlanSubscribeRoute = `/team/${team.slug}/subscribe/plan:starter`;
@@ -68,15 +67,15 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
6867
// free > growth
6968
case "free": {
7069
return {
71-
label: canTrialGrowth ? trialTitle : "Get started",
70+
label: team.growthTrialEligible ? trialTitle : "Get started",
7271
href: growthPlanSubscribeRoute,
7372
};
7473
}
7574

7675
// starter > growth
7776
case "starter": {
7877
return {
79-
label: canTrialGrowth ? trialTitle : "Upgrade",
78+
label: team.growthTrialEligible ? trialTitle : "Upgrade",
8079
href: growthPlanSubscribeRoute,
8180
};
8281
}
@@ -95,7 +94,7 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
9594
};
9695
}
9796
}
98-
}, [validTeamPlan, canTrialGrowth, growthPlanSubscribeRoute]);
97+
}, [team, validTeamPlan, growthPlanSubscribeRoute]);
9998

10099
const proCta: CtaLink | undefined = useMemo(() => {
101100
// pro > pro
@@ -147,17 +146,18 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
147146
target: growthCardCta.target,
148147
tracking: {
149148
category: "account",
150-
label: canTrialGrowth ? "claimGrowthTrial" : "growthPlan",
149+
label: team.growthTrialEligible
150+
? "claimGrowthTrial"
151+
: "growthPlan",
151152
},
152153
variant: "default",
153-
hint:
154-
validTeamPlan === "starter" || validTeamPlan === "free"
155-
? "Your free trial will end after 30 days."
156-
: undefined,
154+
hint: team.growthTrialEligible
155+
? "Your free trial will end after 30 days."
156+
: undefined,
157157
}
158158
: undefined
159159
}
160-
canTrialGrowth={canTrialGrowth}
160+
canTrialGrowth={team.growthTrialEligible || false}
161161
// upsell growth plan if user is on free plan
162162
highlighted={validTeamPlan === "free"}
163163
/>

0 commit comments

Comments
 (0)