fix: skip Select Account step if only one account is available (#23432)

* fix: skip Select Account step if only one account is available

* chore

* chore

* chore

* test fixes

* chore

* refactor: address biome linting issues and decompose getServerSideProps

---------

Co-authored-by: Kartik Saini <[email protected]>
Co-authored-by: Dhairyashil Shinde <[email protected]>
This commit is contained in:
authored and GitHub committed 2026-01-23 22:51:04 +00:00
1 parent a40c3eebd6
commit d9658a5a27
3 files changed
+380 -325

No files matched your search

@@ -102,7 +102,7 @@ type TUpdateObject = {
const OnboardingPage = ({
step,
teams,
teams = [],
personalAccount,
appMetadata,
eventTypeGroups,
@@ -116,6 +116,8 @@ const OnboardingPage = ({
const pathname = usePathname();
const router = useRouter();
const [configureStep, setConfigureStep] = useState(false);
const STEPS_MAP: StepObj = {
[AppOnboardingSteps.ACCOUNTS_STEP]: {
getTitle: () => `${t("select_account_header")}`,
@@ -127,19 +129,18 @@ const OnboardingPage = ({
getTitle: () => `${t("select_event_types_header")}`,
getDescription: (appName) =>
`${t("select_event_types_description", { appName, interpolation: { escapeValue: false } })}`,
stepNumber: installableOnTeams ? 2 : 1,
stepNumber: teams.length > 0 && installableOnTeams ? 2 : 1,
},
[AppOnboardingSteps.CONFIGURE_STEP]: {
getTitle: (appName) =>
`${t("configure_app_header", { appName, interpolation: { escapeValue: false } })}`,
getDescription: () => `${t("configure_app_description")}`,
stepNumber: installableOnTeams ? 3 : 2,
stepNumber: teams.length > 0 && installableOnTeams ? 3 : 2,
},
} as const;
const [configureStep, setConfigureStep] = useState(false);
const currentStep: AppOnboardingSteps = useMemo(() => {
if (step == AppOnboardingSteps.EVENT_TYPES_STEP && configureStep) {
if (step === AppOnboardingSteps.EVENT_TYPES_STEP && configureStep) {
return AppOnboardingSteps.CONFIGURE_STEP;
}
return step;
@@ -150,8 +151,8 @@ const OnboardingPage = ({
if (!showEventTypesStep) {
return 1;
}
return installableOnTeams ? STEPS.length : STEPS.length - 1;
}, [showEventTypesStep, installableOnTeams]);
return teams.length > 0 && installableOnTeams ? STEPS.length : STEPS.length - 1;
}, [showEventTypesStep, teams, installableOnTeams]);
const utils = trpc.useContext();