Skip to content

fix: revert the redirection changes #421

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Livechat from '@/components/chat/Livechat';
import useIsLiveChatWidgetAvailable from '@/components/chat/useIsLiveChatWidgetAvailable';
import { standalone_routes } from '@/components/shared';
import { useOauth2 } from '@/hooks/auth/useOauth2';
import useGrowthbookGetFeatureValue from '@/hooks/growthbook/useGrowthbookGetFeatureValue';
import useRemoteConfig from '@/hooks/growthbook/useRemoteConfig';
import { useIsIntercomAvailable } from '@/hooks/useIntercom';
import useThemeSwitcher from '@/hooks/useThemeSwitcher';
Expand Down Expand Up @@ -58,9 +57,6 @@ const useMobileMenuConfig = (client?: RootStore['client']) => {
const is_virtual = client?.is_virtual;
const currency = client?.getCurrency?.();
const is_logged_in = client?.is_logged_in;
const accounts = client?.accounts || {};

const { featureFlagValue } = useGrowthbookGetFeatureValue<any>({ featureFlag: 'hub_enabled_country_list' });

// Function to add account parameter to URLs
const getAccountUrl = (url: string) => {
Expand All @@ -87,18 +83,6 @@ const useMobileMenuConfig = (client?: RootStore['client']) => {
}
};

const has_wallet = Object.keys(accounts).some(id => accounts[id].account_category === 'wallet');
// Determine the appropriate redirect URL based on user's country
const getRedirectUrl = () => {
// Check if the user's country is in the hub-enabled country list
const is_hub_enabled_country = featureFlagValue?.hub_enabled_country_list?.includes(client?.residence);

if (has_wallet && is_hub_enabled_country) {
return getAccountUrl(standalone_routes.account_settings);
}
return getAccountUrl(standalone_routes.personal_details);
};

const menuConfig = useMemo(
(): TMenuConfig[] => [
[
Expand All @@ -123,7 +107,7 @@ const useMobileMenuConfig = (client?: RootStore['client']) => {
},
{
as: 'a',
href: getRedirectUrl(),
href: getAccountUrl(standalone_routes.account_settings),
label: localize('Account Settings'),
LeftComponent: LegacyProfileSmIcon,
},
Expand Down
Loading