Skip to content

Commit

Permalink
Revert "feat: added p2p standalone iframe + setup localstorage synchr…
Browse files Browse the repository at this point in the history
…onisatio…" (deriv-com#15523)

This reverts commit 1855373.
  • Loading branch information
shahzaib-deriv authored Jun 6, 2024
1 parent 29562a7 commit 2572093
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 38 deletions.
2 changes: 0 additions & 2 deletions packages/core/src/App/AppContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useIsMounted } from '@deriv/shared';
import { observer, useStore } from '@deriv/stores';
import { browserSupportsWebAuthn } from '@simplewebauthn/browser';
import BinaryBotIFrame from 'Modules/BinaryBotIFrame';
import P2PIFrame from 'Modules/P2PIFrame';
import SmartTraderIFrame from 'Modules/SmartTraderIFrame';
import ErrorBoundary from './Components/Elements/Errors/error-boundary.jsx';
import AppToastMessages from './Containers/app-toast-messages.jsx';
Expand Down Expand Up @@ -75,7 +74,6 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough }
</ErrorBoundary>
<SmartTraderIFrame />
<BinaryBotIFrame />
<P2PIFrame />
<AppToastMessages />
<Devtools />
</ThemeProvider>
Expand Down
17 changes: 0 additions & 17 deletions packages/core/src/Modules/P2PIFrame/P2PIFrame.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions packages/core/src/Modules/P2PIFrame/index.ts

This file was deleted.

6 changes: 1 addition & 5 deletions packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
sortApiData,
urlForLanguage,
getAppId,
getUrlp2p,
} from '@deriv/shared';
import { Analytics } from '@deriv-com/analytics';
import { getLanguage, localize, getRedirectionLanguage } from '@deriv/translations';
Expand Down Expand Up @@ -2491,16 +2490,13 @@ export default class ClientStore extends BaseStore {
syncWithLegacyPlatforms(active_loginid, client_accounts) {
const smartTrader = {};
const binaryBot = {};
const p2p = {};

smartTrader.iframe = document.getElementById('localstorage-sync');
binaryBot.iframe = document.getElementById('localstorage-sync__bot');
p2p.iframe = document.getElementById('localstorage-sync__p2p');
smartTrader.origin = getUrlSmartTrader();
binaryBot.origin = getUrlBinaryBot(false);
p2p.origin = getUrlp2p();

[smartTrader, binaryBot, p2p].forEach(platform => {
[smartTrader, binaryBot].forEach(platform => {
if (platform.iframe) {
// Keep client.accounts in sync (in case user wasn't logged in).
platform.iframe.contentWindow.postMessage(
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/root_files/localstorage-sync.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
`https://staging-smarttrader.${domain_url}`,
`https://bot.${domain_url}`,
`https://staging-bot.deriv.com`,
`https://p2p.deriv.com`,
'https://deriv-p2p-app.pages.dev/',
];
if (allowed_origins.includes(message.origin)) {
switch (message.data.key) {
Expand Down
1 change: 0 additions & 1 deletion packages/shared/src/utils/url/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const deriv_urls = Object.freeze({
SMARTTRADER_STAGING: `https://staging-smarttrader.${domain_url}`,
BINARYBOT_PRODUCTION: `https://bot.${domain_url}`,
BINARYBOT_STAGING: `https://staging-bot.${domain_url}`,
P2P_PRODUCTION: `https://p2p.deriv.com`,
});
/**
* @deprecated Please use 'URLConstants.whatsApp' from '@deriv-com/utils' instead of this.
Expand Down
8 changes: 0 additions & 8 deletions packages/shared/src/utils/url/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ export const getUrlBinaryBot = (is_language_required = true) => {
return is_language_required ? `${base_link}/?l=${i18n_language.toLowerCase()}` : base_link;
};

export const getUrlP2P = (is_language_required = true) => {
const url_lang = getlangFromUrl();
const i18n_language = window.localStorage.getItem('i18n_language') || url_lang || 'en';
const base_link = deriv_urls.P2P_PRODUCTION;

return is_language_required ? `${base_link}/?l=${i18n_language.toLowerCase()}` : base_link;
};

export const getPlatformFromUrl = (domain = window.location.hostname) => {
const resolutions = {
is_staging_deriv_app: /^staging-app\.deriv\.(com|me|be)$/i.test(domain),
Expand Down

0 comments on commit 2572093

Please sign in to comment.