Skip to content

Commit

Permalink
chore: add redirection for staging and production bot to standalone b…
Browse files Browse the repository at this point in the history
…ot (#17860)

* chore: add redirection for staging and production bot to standalone bot

* chore: refactor mapping
  • Loading branch information
shafin-deriv authored Dec 23, 2024
1 parent 5da39fa commit 1bfe4a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/bot-web-ui/src/app/app-main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions packages/wallets/src/constants/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 1bfe4a9

Please sign in to comment.