File tree Expand file tree Collapse file tree 5 files changed +18
-1
lines changed
components/settings/Account/Billing Expand file tree Collapse file tree 5 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ type PricingCardProps = {
3232 current ?: boolean ;
3333 canTrialGrowth ?: boolean ;
3434 activeTrialEndsAt ?: string ;
35+ redirectPath : string ;
3536} ;
3637
3738export const PricingCard : React . FC < PricingCardProps > = ( {
@@ -42,6 +43,7 @@ export const PricingCard: React.FC<PricingCardProps> = ({
4243 current = false ,
4344 canTrialGrowth = false ,
4445 activeTrialEndsAt,
46+ redirectPath,
4547} ) => {
4648 const plan = TEAM_PLANS [ billingPlan ] ;
4749 const isCustomPrice = typeof plan . price === "string" ;
@@ -129,6 +131,7 @@ export const PricingCard: React.FC<PricingCardProps> = ({
129131 variant = { cta . variant || "outline" }
130132 teamSlug = { teamSlug }
131133 sku = { billingPlan === "starter" ? "plan:starter" : "plan:growth" }
134+ redirectPath = { redirectPath }
132135 >
133136 { cta . title }
134137 </ CheckoutButton >
Original file line number Diff line number Diff line change @@ -151,7 +151,11 @@ function PageContent(props: {
151151 if ( screen . id === "onboarding" ) {
152152 return (
153153 < Suspense fallback = { < LoadingCard /> } >
154- < LazyOnboardingUI account = { screen . account } onComplete = { onComplete } />
154+ < LazyOnboardingUI
155+ account = { screen . account }
156+ onComplete = { onComplete }
157+ redirectPath = { props . nextPath || "/team" }
158+ />
155159 </ Suspense >
156160 ) ;
157161 }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export function OnboardingChoosePlan(props: {
99 skipPlan : ( ) => Promise < void > ;
1010 canTrialGrowth : boolean ;
1111 teamSlug : string ;
12+ redirectPath : string ;
1213} ) {
1314 return (
1415 < div >
@@ -29,6 +30,7 @@ export function OnboardingChoosePlan(props: {
2930 category : "account" ,
3031 } ,
3132 } }
33+ redirectPath = { props . redirectPath }
3234 />
3335
3436 < PricingCard
@@ -45,6 +47,7 @@ export function OnboardingChoosePlan(props: {
4547 } }
4648 canTrialGrowth = { props . canTrialGrowth }
4749 highlighted
50+ redirectPath = { props . redirectPath }
4851 />
4952 </ div >
5053
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ type OnboardingScreen =
2020function OnboardingUI ( props : {
2121 account : Account ;
2222 onComplete : ( ) => void ;
23+ // path to redirect from stripe
24+ redirectPath : string ;
2325} ) {
2426 const { account } = props ;
2527 const [ screen , setScreen ] = useState < OnboardingScreen > ( { id : "onboarding" } ) ;
@@ -128,6 +130,7 @@ function OnboardingUI(props: {
128130
129131 { screen . id === "plan" && (
130132 < OnboardingChoosePlan
133+ redirectPath = { props . redirectPath }
131134 teamSlug = { screen . team . slug }
132135 skipPlan = { async ( ) => {
133136 await skipOnboarding ( ) . catch ( ( ) => { } ) ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
1818 team,
1919 trialPeriodEndedAt,
2020} ) => {
21+ const pagePath = `/team/${ team . slug } /~/settings/billing` ;
2122 const validTeamPlan = getValidTeamPlan ( team ) ;
2223 const contactUsHref = "/contact-us" ;
2324
@@ -102,6 +103,7 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
102103 < div className = "grid grid-cols-1 gap-6 xl:grid-cols-3" >
103104 { /* Starter */ }
104105 < PricingCard
106+ redirectPath = { pagePath }
105107 billingPlan = "starter"
106108 current = { validTeamPlan === "starter" }
107109 cta = {
@@ -120,6 +122,7 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
120122
121123 { /* Growth */ }
122124 < PricingCard
125+ redirectPath = { pagePath }
123126 billingPlan = "growth"
124127 activeTrialEndsAt = {
125128 validTeamPlan === "growth" ? trialPeriodEndedAt : undefined
@@ -149,6 +152,7 @@ export const BillingPricing: React.FC<BillingPricingProps> = ({
149152 />
150153
151154 < PricingCard
155+ redirectPath = { pagePath }
152156 billingPlan = "pro"
153157 teamSlug = { team . slug }
154158 current = { validTeamPlan === "pro" }
You can’t perform that action at this time.
0 commit comments