From 74efe58c7bf51a2199070714192ab97fada85f6d Mon Sep 17 00:00:00 2001
From: Nivedin <53208152+nivedin@users.noreply.github.com>
Date: Mon, 28 Jul 2025 20:28:35 +0530
Subject: [PATCH] chore: add i18n for onboarding flow and cleanup (#5285)
---
packages/hoppscotch-sh-admin/locales/en.json | 48 ++++++++++++
.../src/components/onboarding/AuthSetup.vue | 43 ++++++----
.../components/onboarding/CompleteScreen.vue | 78 ++++++++++++-------
.../src/components/onboarding/SmtpSetup.vue | 5 +-
.../components/onboarding/WelcomeScreen.vue | 20 +++--
.../composables/useOnboardingConfigHandler.ts | 28 ++++---
.../hoppscotch-sh-admin/src/modules/admin.ts | 13 +++-
.../src/pages/onboarding.vue | 12 ++-
8 files changed, 179 insertions(+), 68 deletions(-)
diff --git a/packages/hoppscotch-sh-admin/locales/en.json b/packages/hoppscotch-sh-admin/locales/en.json
index 3a0b5693..a0c06f03 100644
--- a/packages/hoppscotch-sh-admin/locales/en.json
+++ b/packages/hoppscotch-sh-admin/locales/en.json
@@ -9,6 +9,7 @@
"save": "Save"
},
"app": {
+ "back": "Back",
"collapse_sidebar": "Collapse Sidebar",
"continue_to_dashboard": "Continue to Dashboard",
"expand_sidebar": "Expand Sidebar",
@@ -173,6 +174,53 @@
"toggle_description": "Get updates about the latest at Hoppscotch",
"unsubscribe": "Unsubscribe"
},
+ "onboarding": {
+ "add_atleast_one_auth_provider": "Please add at least one authentication provider to continue.",
+ "add_configurations": "Please add the configurations for the selected authentication methods.",
+ "add_oauth_config": "Add Auth Configurations",
+ "auth_setup": "Authentication Setup",
+ "auth_successfully_configured": "authentication has been successfully configured.",
+ "complete": "Complete",
+ "complete_description": "You have completed the onboarding process. You can now start using Hoppscotch.",
+ "complete_title": "Onboarding Complete",
+ "configurations": "Configurations",
+ "configurations_added_successfully": "Onboarding Configurations added successfully.",
+ "configurations_adding_failed": "Failed to add onboarding configs, please try again.",
+ "configurations_description": "Configure your Hoppscotch instance settings.",
+ "configuration_error": "Failed to add configurations",
+ "configurations_title": "Server Configurations",
+ "configuration_summary": "Configuration Summary",
+ "oauth": {
+ "description": "Set up OAuth providers like Google, GitHub, Microsoft, etc.",
+ "description_accordian": "Select the OAuth providers you want to enable and provide the necessary configurations.",
+ "title": "OAuth"
+ },
+ "onboarding_incomplete": {
+ "description": "You have not completed the onboarding process. Please set up at least one authentication provider to continue.",
+ "title": "Onboarding Incomplete"
+ },
+ "onboarding_fail_help": "If you are facing issues with the onboarding process, please contact support or check",
+ "please_fill_configurations": "Please fill the required field {fieldName}",
+ "save_auth_config": "Save Auth Config",
+ "setup_complete": {
+ "title": "Setup Complete",
+ "description": "You have successfully completed the onboarding process for your Hoppscotch instance.",
+ "description_sub": "The page will automatically redirect to the dashboard in a few seconds or you can reload once the server is restarted."
+ },
+ "server_restarting": "Server is restarting in {time} seconds...",
+ "smtp": {
+ "description": "Set up SMTP for email authentication.",
+ "description_accordian": "Configure the SMTP settings for sending emails.",
+ "title": "SMTP"
+ },
+ "smtp_advanced_config_enable": "Enable to configure your own SMTP credentials",
+ "select_auth_provider": "Please select the authentication methods you want to set up.",
+ "select_atleast_one": "Please select at least one authentication provider to continue.",
+ "start_onboarding": "Start Onboarding",
+ "welcome": "Welcome",
+ "welcome_screen_description": "Welcome to Hoppscotch! Let's get started with the setup.",
+ "welcome_screen_sub_description": "Please set up either SMTP or OAuth for authentication."
+ },
"settings": {
"settings": "Settings"
},
diff --git a/packages/hoppscotch-sh-admin/src/components/onboarding/AuthSetup.vue b/packages/hoppscotch-sh-admin/src/components/onboarding/AuthSetup.vue
index 232c797c..993c166f 100644
--- a/packages/hoppscotch-sh-admin/src/components/onboarding/AuthSetup.vue
+++ b/packages/hoppscotch-sh-admin/src/components/onboarding/AuthSetup.vue
@@ -7,7 +7,7 @@
>
- Please select the authentication methods you want to set up.
+ {{ t('onboarding.select_auth_provider') }}
@@ -20,9 +20,11 @@
}"
@click="toggleSelectedOption('OAuth')"
>
-
OAuth
+
+ {{ t('onboarding.oauth.title') }}
+
- Set up OAuth providers like Google, GitHub, Microsoft, etc.
+ {{ t('onboarding.oauth.description') }}
@@ -52,9 +54,11 @@
}"
@click="toggleSelectedOption('SMTP')"
>
-
SMTP
+
+ {{ t('onboarding.smtp.title') }}
+
- Set up SMTP for email authentication.
+ {{ t('onboarding.smtp.description') }}
- Back
+
+ {{ t('app.back') }}
+
- Please add the configurations for the selected authentication methods.
+ {{ t('onboarding.add_configurations') }}
@@ -107,7 +113,9 @@
- OAuth
+ {{ t('onboarding.oauth.title') }}
+
- Select the OAuth providers you want to enable and provide
-
- the necessary configurations.
+ {{ t('onboarding.oauth.description_accordian') }}
@@ -146,7 +152,9 @@
- SMTP
+
+ {{ t('onboarding.smtp.title') }}
+
- Configure the SMTP settings for sending emails.
+ {{ t('onboarding.smtp.description_accordian') }}
@@ -176,10 +184,11 @@
@@ -200,7 +209,9 @@ import IconLucideArrowRight from '~icons/lucide/arrow-right';
import IconLucideArrowLeft from '~icons/lucide/arrow-left';
import IconLucideSave from '~icons/lucide/save';
import { useToast } from '~/composables/toast';
+import { useI18n } from '~/composables/i18n';
+const t = useI18n();
const toast = useToast();
const props = withDefaults(
@@ -296,7 +307,7 @@ const toggleSelectedOption = (option: 'OAuth' | 'SMTP') => {
const addAuthConfig = () => {
if (selectedOptions.value.length === 0) {
- toast.error('Please select at least one authentication method.');
+ toast.error(t('onboarding.select_atleast_one'));
return;
}
authConfigStep.value = 2;
diff --git a/packages/hoppscotch-sh-admin/src/components/onboarding/CompleteScreen.vue b/packages/hoppscotch-sh-admin/src/components/onboarding/CompleteScreen.vue
index fdd3bd2e..5f3a4508 100644
--- a/packages/hoppscotch-sh-admin/src/components/onboarding/CompleteScreen.vue
+++ b/packages/hoppscotch-sh-admin/src/components/onboarding/CompleteScreen.vue
@@ -6,62 +6,82 @@
onBoardingSummary.configsAdded.length > 0
"
>
-
Setup Complete 🎉
+
+
+ {{ t('onboarding.setup_complete.title') }}
+
+
+
+
- You have successfully completed the onboarding process for your
- Hoppscotch instance.
+ {{ t('onboarding.setup_complete.description') }}
- The page will automatically redirect to the dashboard in a few seconds
- or you can reload once the server is restarted.
+
+ {{ t('onboarding.setup_complete.description_sub') }}
+
-
Configuration Summary
+
+ {{ t('onboarding.configuration_summary') }}
+
{{ config.toLocaleLowerCase() }}
- authentication has been successfully configured.
+ {{ t('onboarding.auth_successfully_configured') }}
- Onboarding Incomplete
-
- There was an issue completing the onboarding process. Please check the
- configurations and try again.
-
-
-
- If you need help, please refer to the
- documentation.
-
+
+
+
+ {{ t('onboarding.onboarding_incomplete.title') }}
+
+
+
+
+ {{ t('onboarding.onboarding_incomplete.description') }}
+
+
+
+ {{ t('onboarding.onboarding_fail_help') }}
+ documentation.
+
+
@@ -70,8 +90,10 @@
import { HoppButtonPrimary } from '@hoppscotch/ui';
import { onMounted, onUnmounted, ref } from 'vue';
import { useRouter } from 'vue-router';
+import { useI18n } from '~/composables/i18n';
import { OnBoardingSummary } from '~/composables/useOnboardingConfigHandler';
+const t = useI18n();
const router = useRouter();
const props = defineProps<{
diff --git a/packages/hoppscotch-sh-admin/src/components/onboarding/SmtpSetup.vue b/packages/hoppscotch-sh-admin/src/components/onboarding/SmtpSetup.vue
index 6a46da93..c87db9c6 100644
--- a/packages/hoppscotch-sh-admin/src/components/onboarding/SmtpSetup.vue
+++ b/packages/hoppscotch-sh-admin/src/components/onboarding/SmtpSetup.vue
@@ -56,7 +56,7 @@
{{ smtp.USE_CUSTOM_CONFIGS.text }}
- Enable to configure your own SMTP credentials
+ {{ t('onboarding.smtp_advanced_config_enable') }}
@@ -69,6 +69,9 @@ import {
EnabledConfig,
MailerConfigKeys,
} from '~/composables/useOnboardingConfigHandler';
+import { useI18n } from '~/composables/i18n';
+
+const t = useI18n();
const props = defineProps<{
currentConfigs: Configs;
diff --git a/packages/hoppscotch-sh-admin/src/components/onboarding/WelcomeScreen.vue b/packages/hoppscotch-sh-admin/src/components/onboarding/WelcomeScreen.vue
index 76f65bb7..3da8b29f 100644
--- a/packages/hoppscotch-sh-admin/src/components/onboarding/WelcomeScreen.vue
+++ b/packages/hoppscotch-sh-admin/src/components/onboarding/WelcomeScreen.vue
@@ -3,16 +3,26 @@

-
Welcome
+
+ {{ t('onboarding.welcome') }}
+
- This is the onboarding process for setting up your Hoppscotch
- instance.
+ {{ t('onboarding.welcome_screen_description') }}
- Please set up either SMTP or OAuth for authentication.
+ {{ t('onboarding.welcome_screen_sub_description') }}
-
+
+
+
diff --git a/packages/hoppscotch-sh-admin/src/composables/useOnboardingConfigHandler.ts b/packages/hoppscotch-sh-admin/src/composables/useOnboardingConfigHandler.ts
index 0899296b..1ef79321 100644
--- a/packages/hoppscotch-sh-admin/src/composables/useOnboardingConfigHandler.ts
+++ b/packages/hoppscotch-sh-admin/src/composables/useOnboardingConfigHandler.ts
@@ -111,8 +111,8 @@ export function useOnboardingConfigHandler() {
const onBoardingSummary = ref({
type: 'success',
- message: t('onboarding.addConfigsSuccess'),
- description: t('onboarding.addConfigsDescription'),
+ message: t('onboarding.setup_complete.title'),
+ description: t('onboarding.setup_complete.description'),
configsAdded: [] as string[],
});
@@ -182,9 +182,10 @@ export function useOnboardingConfigHandler() {
if (addedConfigs.length === 0) {
return {
type: 'error',
- message: t('onboarding.addConfigsError'),
- description: t('onboarding.addConfigsDescription', {
- error: error?.message || t('onboarding.addConfigsDefaultError'),
+ message: t('onboarding.onboarding_incomplete.title'),
+ description: t('onboarding.onboarding_incomplete.description', {
+ error:
+ error?.message || t('onboarding.onboarding_incomplete.description'),
}),
configsAdded: [],
};
@@ -192,8 +193,8 @@ export function useOnboardingConfigHandler() {
return {
type: 'success',
- message: t('onboarding.addConfigsSuccess'),
- description: t('onboarding.addConfigsDescription'),
+ message: t('onboarding.setup_complete.title'),
+ description: t('onboarding.setup_complete.description'),
configsAdded: addedConfigs.filter((key) => key !== 'MAILER'),
};
};
@@ -235,7 +236,7 @@ export function useOnboardingConfigHandler() {
*/
const validateConfigs = (configs: Partial>) => {
if (!configs || Object.keys(configs).length === 0) {
- toast.error(t('onboarding.addConfigsError'));
+ toast.error(t('onboarding.configuration_error'));
return;
}
@@ -250,7 +251,9 @@ export function useOnboardingConfigHandler() {
neededKeys.forEach((key) => {
if (!configs[key])
toast.error(
- `Please fill the required field: ${makeReadableKey(key)}`
+ t('onboarding.please_fill_configurations', {
+ fieldName: makeReadableKey(key),
+ })
);
});
return;
@@ -284,7 +287,8 @@ export function useOnboardingConfigHandler() {
const validated = validateConfigs(payload);
if (!validated || Object.keys(validated).length === 0) {
- toast.error('Please add at least one config');
+ toast.error(t('onboarding.add_atleast_one_auth_provider'));
+ submittingConfigs.value = false;
return;
}
@@ -299,13 +303,13 @@ export function useOnboardingConfigHandler() {
const res = await auth.addOnBoardingConfigs(configWithAuth);
if (res?.token) {
setLocalConfig('access_token', res.token);
- toast.success('Onboarding configs added successfully');
+ toast.success(t('onboarding.configurations_added_successfully'));
onBoardingSummary.value = makeOnboardingSummary();
return res;
}
} catch (err) {
console.error('Failed to add onboarding configs', err);
- toast.error('Failed to add onboarding configs');
+ toast.error(t('onboarding.configurations_adding_failed'));
onBoardingSummary.value = makeOnboardingSummary(err as Error);
} finally {
submittingConfigs.value = false;
diff --git a/packages/hoppscotch-sh-admin/src/modules/admin.ts b/packages/hoppscotch-sh-admin/src/modules/admin.ts
index fd266904..12ec449c 100644
--- a/packages/hoppscotch-sh-admin/src/modules/admin.ts
+++ b/packages/hoppscotch-sh-admin/src/modules/admin.ts
@@ -45,7 +45,14 @@ export default {
return next();
}
- const isAdmin = res.data?.me.isAdmin;
+ if (
+ !onboardingStatus?.onboardingCompleted &&
+ !onboardingStatus?.canReRunOnboarding &&
+ to.name !== 'index' &&
+ to.name === 'onboarding'
+ ) {
+ return next();
+ }
if (
onboardingStatus?.onboardingCompleted &&
@@ -56,6 +63,8 @@ export default {
return next({ name: 'index' });
}
+ const isAdmin = res.data?.me.isAdmin;
+
// Route Guards
if (!isGuestRoute(to.name) && !isAdmin) {
/**
@@ -65,7 +74,7 @@ export default {
return next({ name: 'index' });
}
- if (isAdmin) {
+ if (isAdmin && onboardingStatus?.onboardingCompleted) {
// These route guards applies to the case where the user is logged in successfully and validated as an admin
const isInfraNotSetup = await getFirstTimeInfraSetupStatus();
diff --git a/packages/hoppscotch-sh-admin/src/pages/onboarding.vue b/packages/hoppscotch-sh-admin/src/pages/onboarding.vue
index 81de8de3..403bbe15 100644
--- a/packages/hoppscotch-sh-admin/src/pages/onboarding.vue
+++ b/packages/hoppscotch-sh-admin/src/pages/onboarding.vue
@@ -3,10 +3,10 @@
- HOPPSCOTCH
+ {{ t('app.name') }}
@@ -41,9 +41,11 @@ import { useRouter } from 'vue-router';
import AuthSetup from '~/components/onboarding/AuthSetup.vue';
import CompleteOnboarding from '~/components/onboarding/CompleteScreen.vue';
import WelcomeScreen from '~/components/onboarding/WelcomeScreen.vue';
+import { useI18n } from '~/composables/i18n';
import { OnBoardingSummary } from '~/composables/useOnboardingConfigHandler';
import { auth } from '~/helpers/auth';
+const t = useI18n();
const router = useRouter();
// Steps
@@ -99,8 +101,10 @@ watch(
);
// Push to URL when step changes
-watch(step, (newStep) => {
- router.replace({ name: 'onboarding', query: { step: newStep.toString() } });
+watch(step, async (newStep) => {
+ if (newStep !== STEP.COMPLETE) {
+ router.replace({ name: 'onboarding', query: { step: newStep.toString() } });
+ }
});
// Load onboarding status