Skip to content
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

feat: Add logic to redirect users based on their plan when creating a new organization #7856

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions packages/insomnia/src/ui/routes/organization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -838,15 +838,33 @@ const OrganizationRoute = () => {
}

if (action === 'new-organization') {
if (currentPlan?.type !== 'enterprise-member') {
// If user is in the scratchpad workspace redirect them to the login page
if (isScratchpadWorkspace) {
window.main.openInBrowser(
`${getAppWebsiteBaseURL()}/app/organization/create`,
getLoginUrl(),
);
} else {
}

if (!currentPlan) {
return;
}

if (currentPlan.type === 'enterprise-member') {
// If user has a team or enterprise member plan show them an alert
showAlert({
title: 'Could not create new organization.',
title: 'Cannot create new organization.',
message: 'Your Insomnia account is tied to the enterprise corporate account. Please ask the owner of the enterprise billing to create one for you.',
});
} else if (['free', 'individual'].includes(currentPlan.type)) {
// If user has a free or individual plan redirect them to the landing page
window.main.openInBrowser(
`${getAppWebsiteBaseURL()}/app/landing-page`,
);
} else {
// If user has a team or enterprise plan redirect them to the create organization page
window.main.openInBrowser(
`${getAppWebsiteBaseURL()}/app/dashboard/organizations?create_org=true`,
);
}
}
}}
Expand Down
Loading