From 7325662cbeb6f2c3634218dcd175fccaf748ce75 Mon Sep 17 00:00:00 2001 From: mayuran-deriv <129507167+mayuran-deriv@users.noreply.github.com> Date: Mon, 29 Sep 2025 14:55:55 +0400 Subject: [PATCH] Revert "fix: diel country block" --- i18n/en/code.json | 10 +----- i18n/fr/code.json | 11 +----- .../app-manager/app-manager.context.tsx | 1 - .../app-manager/app-manager.provider.tsx | 11 +----- src/contexts/auth/auth.provider.tsx | 24 ++++++------- .../permission-denied-error.scss | 24 ------------- .../permission-denied-error.tsx | 36 ------------------- src/features/dashboard/dashboard.tsx | 7 +--- .../dashboard/hooks/useGetApp/index.tsx | 4 +-- 9 files changed, 16 insertions(+), 112 deletions(-) delete mode 100644 src/features/dashboard/components/permission-denied-error/permission-denied-error.scss delete mode 100644 src/features/dashboard/components/permission-denied-error/permission-denied-error.tsx diff --git a/i18n/en/code.json b/i18n/en/code.json index 7e4f64204..64c240335 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -1175,6 +1175,7 @@ "Demo account": { "message": "Demo account" }, + "Deriv.com": { "message": "Deriv.com" }, @@ -1192,14 +1193,5 @@ }, "Get real account": { "message": "Get real account" - }, - "Not available in your region": { - "message": "Not available in your region" - }, - "You can still use our other products and services.": { - "message": "You can still use our other products and services." - }, - "Go to home": { - "message": "Go to home" } } diff --git a/i18n/fr/code.json b/i18n/fr/code.json index 83774b4a1..d7269ec66 100644 --- a/i18n/fr/code.json +++ b/i18n/fr/code.json @@ -12,7 +12,7 @@ "message": "Tableau de bord" }, "API explorer": { - "message": "API explorer" + "message": "Explorateur d'API" }, "Deriv Tech": { "message": "Deriv Tech" @@ -1192,14 +1192,5 @@ }, "Get real account": { "message": "Obtenir un compte réel" - }, - "Not available in your region": { - "message": "N'est pas disponible dans votre région" - }, - "You can still use our other products and services.": { - "message": "Vous pouvez toujours utiliser nos autres produits et services." - }, - "Go to home": { - "message": "Rentrez à la page d'accueil" } } diff --git a/src/contexts/app-manager/app-manager.context.tsx b/src/contexts/app-manager/app-manager.context.tsx index 3c1c1b463..725ef96af 100644 --- a/src/contexts/app-manager/app-manager.context.tsx +++ b/src/contexts/app-manager/app-manager.context.tsx @@ -20,7 +20,6 @@ export type TAppManagerContext = { setIsDashboard: Dispatch>; app_register_modal_open: boolean; setAppRegisterModalOpen: Dispatch>; - is_dashboard_blocked: boolean; }; export const AppManagerContext = createContext(null); diff --git a/src/contexts/app-manager/app-manager.provider.tsx b/src/contexts/app-manager/app-manager.provider.tsx index 1ea8370fe..48eba0109 100644 --- a/src/contexts/app-manager/app-manager.provider.tsx +++ b/src/contexts/app-manager/app-manager.provider.tsx @@ -14,9 +14,8 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => { const [is_dashboard, setIsDashboard] = useState(false); const [app_register_modal_open, setAppRegisterModalOpen] = useState(false); const [current_updating_item, setCurrentUpdateItem] = useState({}); - const { getAllApps, apps: updatedApps, error } = useGetApps(); + const { getAllApps, apps: updatedApps } = useGetApps(); const { is_authorized } = useAuthContext(); - const [is_dashboard_blocked, setIsDashboardBlocked] = useState(false); const getApps = useCallback(() => { if (is_authorized) { @@ -33,12 +32,6 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => { } }, []); - useEffect(() => { - if (error?.error?.code === 'AppList') { - setIsDashboardBlocked(true); - } - }, [error]); - const handleCurrentUpdatingItem = useCallback((item: ApplicationObject) => { setCurrentUpdateItem(item); }, []); @@ -59,7 +52,6 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => { app_register_modal_open, handleCurrentUpdatingItem, current_updating_item, - is_dashboard_blocked, }; }, [ apps, @@ -72,7 +64,6 @@ const AppManagerContextProvider = ({ children }: TAppManagerContextProps) => { setAppRegisterModalOpen, handleCurrentUpdatingItem, current_updating_item, - is_dashboard_blocked, ]); return {children}; diff --git a/src/contexts/auth/auth.provider.tsx b/src/contexts/auth/auth.provider.tsx index ff80dacbf..7f2be7c57 100644 --- a/src/contexts/auth/auth.provider.tsx +++ b/src/contexts/auth/auth.provider.tsx @@ -81,20 +81,16 @@ const AuthProvider = ({ children }: TAuthProviderProps) => { const updateAuthorize = useCallback(async () => { if (currentLoginAccount.token) { - try { - const { authorize } = await apiManager.authorize( - currentLoginAccount.token, - setIsConnected, - setIsAuthorized, - ); - setIsAuthorized(true); - setisSwitchingAccount(false); - const { account_list, ...user } = authorize; - setUserAccounts(account_list); - setUser(user); - } catch (error) { - console.error('Failed to authorize:', error); - } + const { authorize } = await apiManager.authorize( + currentLoginAccount.token, + setIsConnected, + setIsAuthorized, + ); + setIsAuthorized(true); + setisSwitchingAccount(false); + const { account_list, ...user } = authorize; + setUserAccounts(account_list); + setUser(user); } }, [currentLoginAccount.token, setUser, setUserAccounts]); diff --git a/src/features/dashboard/components/permission-denied-error/permission-denied-error.scss b/src/features/dashboard/components/permission-denied-error/permission-denied-error.scss deleted file mode 100644 index 4d9b0adfc..000000000 --- a/src/features/dashboard/components/permission-denied-error/permission-denied-error.scss +++ /dev/null @@ -1,24 +0,0 @@ -.permission-denied-container { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - min-height: 60vh; - padding: 2rem; - text-align: center; -} - -.permission-denied-content { - max-width: 600px; - margin: 0 auto; - - h1 { - margin-bottom: 1rem; - color: var(--ifm-color-danger); - } - - p { - margin-bottom: 2rem; - font-size: 1.2rem; - } -} diff --git a/src/features/dashboard/components/permission-denied-error/permission-denied-error.tsx b/src/features/dashboard/components/permission-denied-error/permission-denied-error.tsx deleted file mode 100644 index bea0e3790..000000000 --- a/src/features/dashboard/components/permission-denied-error/permission-denied-error.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import { translate } from '@docusaurus/Translate'; -import { Button } from '@deriv-com/quill-ui'; -import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; -import './permission-denied-error.scss'; - -const PermissionDeniedError = () => { - const { - i18n: { currentLocale }, - } = useDocusaurusContext(); - - const is_en = currentLocale === 'en'; - const homeUrl = `${!is_en ? `/${currentLocale}` : ''}/`; - - const handleGoHome = () => { - window.location.href = homeUrl; - }; - - return ( -
-
-

{translate({ message: 'Not available in your region' })}

-

- {translate({ - message: 'You can still use our other products and services.', - })} -

- -
-
- ); -}; - -export default PermissionDeniedError; diff --git a/src/features/dashboard/dashboard.tsx b/src/features/dashboard/dashboard.tsx index 411224bfb..44d3b1fcb 100644 --- a/src/features/dashboard/dashboard.tsx +++ b/src/features/dashboard/dashboard.tsx @@ -5,11 +5,10 @@ import ManageDashboard from './manage-dashboard'; import { Login } from '../Login/Login'; import BrowserOnly from '@docusaurus/BrowserOnly'; import { Fallback } from '../Fallback'; -import PermissionDeniedError from './components/permission-denied-error/permission-denied-error'; const Dashboard = () => { const { is_logged_in, siteActive } = useAuthContext(); - const { setIsDashboard, is_dashboard_blocked } = useAppManager(); + const { setIsDashboard } = useAppManager(); useEffect(() => { setIsDashboard(true); @@ -19,10 +18,6 @@ const Dashboard = () => { }, [setIsDashboard]); if (!siteActive) return ; - - // Show permission denied error if the flag is set - if (is_logged_in && is_dashboard_blocked) return ; - if (is_logged_in) return ; return {() => }; }; diff --git a/src/features/dashboard/hooks/useGetApp/index.tsx b/src/features/dashboard/hooks/useGetApp/index.tsx index 8665ef7ff..92c22aa44 100644 --- a/src/features/dashboard/hooks/useGetApp/index.tsx +++ b/src/features/dashboard/hooks/useGetApp/index.tsx @@ -2,13 +2,13 @@ import useWS from '@site/src/hooks/useWs'; import { useCallback } from 'react'; const useGetApps = () => { - const { send, data, is_loading, error } = useWS('app_list'); + const { send, data, is_loading } = useWS('app_list'); const getAllApps = useCallback(() => { send(); }, [send]); - return { getAllApps, apps: data, is_loading, error }; + return { getAllApps, apps: data, is_loading }; }; export default useGetApps;