From 1bfe4a9b7ae58e378bcc7477425191fc28134e51 Mon Sep 17 00:00:00 2001 From: Shafin Al Karim <129021108+shafin-deriv@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:24:06 +0800 Subject: [PATCH] chore: add redirection for staging and production bot to standalone bot (#17860) * chore: add redirection for staging and production bot to standalone bot * chore: refactor mapping --- packages/bot-web-ui/src/app/app-main.tsx | 17 +++++++++++++++++ packages/wallets/src/constants/constants.tsx | 1 + 2 files changed, 18 insertions(+) diff --git a/packages/bot-web-ui/src/app/app-main.tsx b/packages/bot-web-ui/src/app/app-main.tsx index 962b5fd3da5a..a85700f49976 100644 --- a/packages/bot-web-ui/src/app/app-main.tsx +++ b/packages/bot-web-ui/src/app/app-main.tsx @@ -12,7 +12,24 @@ type TAppProps = { }; }; +const originToDomainMap = { + 'staging-app.deriv.com': 'staging-dbot.deriv.com', + 'staging-app.deriv.me': 'staging-dbot.deriv.com', + 'staging-app.deriv.be': 'staging-dbot.deriv.com', + 'app.deriv.com': 'dbot.deriv.com', + 'app.deriv.me': 'dbot.deriv.me', + 'app.deriv.be': 'dbot.deriv.be', +}; + const App = ({ passthrough }: TAppProps) => { + // Extract the correct domain based on the current origin + const targetDomain = originToDomainMap[window.location.host as keyof typeof originToDomainMap]; + + // Redirect to the dbot.deriv.com only from staging and production + if (targetDomain) { + window.location.assign(`https://${targetDomain}`); + } + const { root_store, WS } = passthrough; React.useEffect(() => { // Setting the inner height of the document to the --vh variable to fix the issue diff --git a/packages/wallets/src/constants/constants.tsx b/packages/wallets/src/constants/constants.tsx index f5f06509613e..f2a6b12ab643 100644 --- a/packages/wallets/src/constants/constants.tsx +++ b/packages/wallets/src/constants/constants.tsx @@ -26,6 +26,7 @@ export const getOptionsAndMultipliersContent = ( { availability: 'Non-EU', description: localize('The ultimate bot trading platform.'), + isExternal: true, key: 'bot', redirect: '/bot', title: 'Deriv Bot',