-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Onboarding - add nextPath logic after email verification #12342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR implements nextPath logic after email verification to maintain billing session state, ensuring users are redirected to their selected plan page after verifying their email address.
- Added
verifyEmailNextPathState
to store and manage post-verification redirect paths - Modified
usePageChangeEffectNavigateLocation
to handle redirection based onverifyEmailNextPath
- Updated
SignUpInput
DTO and mutation to includeverifyEmailNextPath
parameter - Added
buildAppPathWithQueryParams
utility but needs URI encoding for security - Removed
isQueryParamInitializedState
in favor of deep equality checks for state updates
17 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -43,6 +44,7 @@ export const usePageChangeEffectNavigateLocation = () => { | |||
const objectMetadataItem = objectMetadataItems.find( | |||
(objectMetadataItem) => objectMetadataItem.namePlural === objectNamePlural, | |||
); | |||
const verifyEmailNextPath = useRecoilValue(verifyEmailNextPathState); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider adding a type annotation for verifyEmailNextPath to make the expected type more explicit
packages/twenty-front/src/modules/app/hooks/useInitializeQueryParamState.ts
Outdated
Show resolved
Hide resolved
...nty-server/src/engine/core-modules/email-verification/services/email-verification.service.ts
Show resolved
Hide resolved
@@ -58,6 +60,12 @@ export const usePageChangeEffectNavigateLocation = () => { | |||
onboardingStatus === OnboardingStatus.PLAN_REQUIRED && | |||
!someMatchingLocationOf([AppPath.PlanRequired, AppPath.PlanRequiredSuccess]) | |||
) { | |||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely satisfied of nesting verifyEmail redirection condition here (because it should not be dependant of billing), but without, chooseYouPlan modal blinks.
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:44573 This environment will automatically shut down when the PR is closed or after 5 hours. |
packages/twenty-front/src/modules/app/hooks/useInitializeQueryParamState.ts
Show resolved
Hide resolved
) Context : Plan choice [on pricing page on website](https://twenty.com/pricing) should redirect you the right plan on app /plan-required page (after sign in), thanks to query parameters and BillingCheckoutSessionState sync. With email verification, an other session starts at CTA click in verification email. Initial BillingCheckoutSessionState is lost and user can't submit to the plan he choose. Solution : Pass a nextPath query parameter in email verification link To test : - Modify .env to add IS_BILLING_ENABLED (+ reset db + sync billing) + IS_EMAIL_VERIFICATION_REQUIRED - Start test from this page http://app.localhost:3001/welcome?billingCheckoutSession={%22plan%22:%22ENTERPRISE%22,%22interval%22:%22Year%22,%22requirePaymentMethod%22:true} - After verification, check you arrive on /plan-required page with Enterprise plan on a yearly interval (default is Pro/monthly). closes twentyhq#12288
) Context : Plan choice [on pricing page on website](https://twenty.com/pricing) should redirect you the right plan on app /plan-required page (after sign in), thanks to query parameters and BillingCheckoutSessionState sync. With email verification, an other session starts at CTA click in verification email. Initial BillingCheckoutSessionState is lost and user can't submit to the plan he choose. Solution : Pass a nextPath query parameter in email verification link To test : - Modify .env to add IS_BILLING_ENABLED (+ reset db + sync billing) + IS_EMAIL_VERIFICATION_REQUIRED - Start test from this page http://app.localhost:3001/welcome?billingCheckoutSession={%22plan%22:%22ENTERPRISE%22,%22interval%22:%22Year%22,%22requirePaymentMethod%22:true} - After verification, check you arrive on /plan-required page with Enterprise plan on a yearly interval (default is Pro/monthly). closes twentyhq#12288
Context :
Plan choice on pricing page on website should redirect you the right plan on app /plan-required page (after sign in), thanks to query parameters and BillingCheckoutSessionState sync.
With email verification, an other session starts at CTA click in verification email. Initial BillingCheckoutSessionState is lost and user can't submit to the plan he choose.
Solution :
Pass a nextPath query parameter in email verification link
To test :
closes #12288