## What does this PR do? - Redirects users to the personal settings page after organization creation instead of the getting-started page - Adds a new `skipToPersonal` function in `useSubmitOnboarding` hook to handle this redirection - Creates a new `getGettingStartedPathWhenInvited` method in `OnboardingPathService` to provide the correct path for invited users - Updates all invitation-related code to use the new path method - Improves UI spacing in the organization invite view ## Visual Demo (For contributors especially) #### Image Demo (if applicable): - Before: Users were redirected to `/onboarding/getting-started` or `/getting-started` after organization creation - After: Users are now redirected to `/onboarding/personal/settings` or `/getting-started` based on feature flag ## Mandatory Tasks (DO NOT REMOVE) - [ ] I have self-reviewed the code. - [ ] I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. - [ ] I confirm automated tests are in place that prove my fix is effective or that my feature works. ## How should this be tested? 1. Create a new organization through the onboarding flow 2. Verify you are redirected to the personal settings page instead of getting-started 3. Accept an invitation to an organization as a new user 4. Verify you are directed to the personal settings page after signup 5. Check that the UI spacing in the organization invite view looks correct ## Checklist - I have read the [contributing guide](https://github.com/calcom/cal.com/blob/main/CONTRIBUTING.md) - My code follows the style guidelines of this project - I have commented my code, particularly in hard-to-understand areas - I have checked if my changes generate no new warnings
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
|
import type { PrismaClient } from "@calcom/prisma";
|
|
|
|
export class OnboardingPathService {
|
|
static async getGettingStartedPath(prisma: PrismaClient): Promise<string> {
|
|
const featuresRepository = new FeaturesRepository(prisma);
|
|
const onboardingV3Enabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("onboarding-v3");
|
|
return onboardingV3Enabled ? "/onboarding/getting-started" : "/getting-started";
|
|
}
|
|
|
|
static async getGettingStartedPathWhenInvited(prisma: PrismaClient): Promise<string> {
|
|
const featuresRepository = new FeaturesRepository(prisma);
|
|
const onboardingV3Enabled = await featuresRepository.checkIfFeatureIsEnabledGlobally("onboarding-v3");
|
|
return onboardingV3Enabled ? "/onboarding/personal/settings" : "/getting-started";
|
|
}
|
|
|
|
static async getGettingStartedPathWithParams(
|
|
prisma: PrismaClient,
|
|
queryParams?: Record<string, string>
|
|
): Promise<string> {
|
|
const basePath = await OnboardingPathService.getGettingStartedPath(prisma);
|
|
|
|
if (!queryParams || Object.keys(queryParams).length === 0) {
|
|
return basePath;
|
|
}
|
|
|
|
const params = new URLSearchParams(queryParams);
|
|
return `${basePath}?${params.toString()}`;
|
|
}
|
|
}
|