From db7de7867922e6b0faec973b1ccee4c0b9f659b5 Mon Sep 17 00:00:00 2001 From: Muhammad Fasih Ali Naqvi Date: Fri, 3 May 2024 11:56:21 +0800 Subject: [PATCH 01/10] chore: removed platform context --- .../__tests__/route-with-sub-routes.spec.tsx | 13 +-- .../__tests__/account-limits.spec.tsx | 104 +++--------------- .../account-limits/account-limits.tsx | 12 +- .../missing-personal-details.spec.tsx | 18 +-- .../missing-personal-details.tsx | 6 +- .../__tests__/upload-complete.spec.tsx | 22 ++-- .../upload-complete/upload-complete.tsx | 34 +----- .../__tests__/self-exclusion-article.spec.tsx | 41 ++----- .../self-exclusion-article-content.tsx | 20 ++-- .../self-exclusion/self-exclusion-inputs.tsx | 25 +---- .../Security/AccountClosed/account-closed.tsx | 7 +- .../cfd/src/Components/Routes/binary-link.jsx | 4 +- .../src/Components/Routes/binary-routes.jsx | 5 +- .../send-email-template.tsx | 10 +- .../src/components/static-url/static-url.tsx | 5 +- packages/components/stories/icon/icons.js | 3 + .../components/stories/static-url/README.md | 24 ++-- .../stories/static-url/stories/basic.js | 11 +- packages/core/src/App/AppContent.tsx | 5 +- .../NotificationMessage/notification.jsx | 5 +- .../Layout/Header/account-actions.jsx | 6 +- .../src/App/Components/Routes/binary-link.jsx | 5 +- .../App/Components/Routes/binary-routes.jsx | 4 +- .../App/Containers/Layout/app-contents.jsx | 4 +- .../PlatformContainer/PlatformContainer.jsx | 21 ---- .../App/Containers/PlatformContainer/index.js | 1 - .../RealAccountSignup/modal-login-prompt.jsx | 10 +- .../src/App/Containers/Redirect/redirect.jsx | 16 +-- .../routes/__tests__/binary-routes.spec.tsx | 8 +- packages/shared/src/utils/platform/index.ts | 1 - .../src/utils/platform/platform-context.tsx | 15 --- 31 files changed, 114 insertions(+), 351 deletions(-) delete mode 100644 packages/core/src/App/Containers/PlatformContainer/PlatformContainer.jsx delete mode 100644 packages/core/src/App/Containers/PlatformContainer/index.js delete mode 100644 packages/shared/src/utils/platform/platform-context.tsx diff --git a/packages/account/src/Components/Routes/__tests__/route-with-sub-routes.spec.tsx b/packages/account/src/Components/Routes/__tests__/route-with-sub-routes.spec.tsx index 6ab27da42485..d0ec96edeb31 100644 --- a/packages/account/src/Components/Routes/__tests__/route-with-sub-routes.spec.tsx +++ b/packages/account/src/Components/Routes/__tests__/route-with-sub-routes.spec.tsx @@ -2,7 +2,6 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import { RouteWithSubRoutesRender } from '../route-with-sub-routes'; import { Redirect } from 'react-router-dom'; -import { PlatformContext } from '@deriv/shared'; jest.mock('react-router-dom', () => ({ ...jest.requireActual('react-router-dom'), @@ -21,22 +20,14 @@ afterEach(() => { describe('', () => { it('should render one component', () => { - render( - - - - ); + render(); expect(screen.getByText(/Route loaded/)).toBeInTheDocument(); }); it('should have props as passed as route', () => { const route = { path: '/test', component: Redirect, title: '', exact: true, to: '/root' }; - render( - - - - ); + render(); expect(screen.getByText(/route loaded true \/test/i)).toBeInTheDocument(); }); }); diff --git a/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx b/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx index f521a336dcdd..b8d2f5681d2e 100644 --- a/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx +++ b/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { screen, render } from '@testing-library/react'; -import { formatMoney, isDesktop, isMobile, PlatformContext } from '@deriv/shared'; +import { formatMoney, isDesktop, isMobile } from '@deriv/shared'; import AccountLimits from '../account-limits'; import { BrowserRouter } from 'react-router-dom'; import { StoreProvider, mockStore } from '@deriv/stores'; @@ -362,25 +362,6 @@ describe('', () => { ).toBeInTheDocument(); }); - it('withdrawal_limits_table should show `Total withdrawal limit` if is_fully_authenticated is false and is_appstore is true', () => { - store = mockStore({ - client: { - ...mock.client, - is_fully_authenticated: false, - }, - }); - render( - - - - - - - - ); - expect(screen.getByText(/total withdrawal limit/i)).toBeInTheDocument(); - }); - it('withdrawal_limits_table should show `Total withdrawal allowed` when is_fully_authenticated is false and is_appstore is true', () => { store = mockStore({ client: { @@ -389,66 +370,13 @@ describe('', () => { }, }); render( - - - - - + + + ); expect(screen.getByText(/total withdrawal allowed/i)).toBeInTheDocument(); }); - it('withdrawal_limits_table should show the verfiy button when is_fully_authenticated is false and is_appstore is true', () => { - store = mockStore({ - client: { - ...mock.client, - is_fully_authenticated: false, - }, - }); - render( - - - - - - - - ); - expect(screen.getByText(/to increase limit please verify your identity/i)).toBeInTheDocument(); - expect( - screen.getByRole('link', { - name: /verify/i, - }) - ).toHaveAttribute('href', '/account/proof-of-identity'); - const { num_of_days_limit } = store.client.account_limits; - expect(formatMoney).toHaveBeenCalledWith(store.client.currency, num_of_days_limit, true); - }); - - it('withdrawal_limits_table should show total withdrawn and withdrawn remaining details', () => { - store = mockStore({ - client: { - ...mock.client, - is_fully_authenticated: false, - }, - }); - render( - - - - - - - - ); - const { withdrawal_since_inception_monetary, remainder } = store.client.account_limits; - - expect(screen.getByText(/total withdrawn/i)).toBeInTheDocument(); - expect(formatMoney).toHaveBeenCalledWith(store.client.currency, withdrawal_since_inception_monetary, true); - - expect(screen.getByText(/maximum withdrawal remaining/i)).toBeInTheDocument(); - expect(formatMoney).toHaveBeenCalledWith(store.client.currency, remainder, true); - }); - it('should show limit_notice message when is_appstore is false and is_fully_authenticated is false in mobile mode', () => { store = mockStore({ client: { @@ -459,13 +387,11 @@ describe('', () => { (isMobile as jest.Mock).mockReturnValue(true); (isDesktop as jest.Mock).mockReturnValue(false); render( - - - - - - - + + + + + ); expect(screen.getByText(/stated limits are subject to change without prior notice\./i)).toBeInTheDocument(); }); @@ -480,13 +406,11 @@ describe('', () => { (isMobile as jest.Mock).mockReturnValue(false); (isDesktop as jest.Mock).mockReturnValue(true); render( - - - - - - - + + + + + ); expect( screen.queryByText(/your account is fully authenticated and your withdrawal limits have been lifted\./i) diff --git a/packages/account/src/Components/account-limits/account-limits.tsx b/packages/account/src/Components/account-limits/account-limits.tsx index 171b0e5749b7..b5f9ae208f6a 100644 --- a/packages/account/src/Components/account-limits/account-limits.tsx +++ b/packages/account/src/Components/account-limits/account-limits.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormikValues } from 'formik'; import classNames from 'classnames'; -import { formatMoney, isDesktop, isMobile, useIsMounted, PlatformContext } from '@deriv/shared'; +import { formatMoney, isDesktop, isMobile, useIsMounted } from '@deriv/shared'; import { Loading, ThemedScrollbars } from '@deriv/components'; import { Localize, localize } from '@deriv/translations'; import { observer, useStore } from '@deriv/stores'; @@ -49,7 +49,6 @@ const AccountLimits = observer( const isMounted = useIsMounted(); const [is_loading, setLoading] = React.useState(true); const [is_overlay_shown, setIsOverlayShown] = React.useState(false); - const { is_appstore } = React.useContext(PlatformContext); const handleGetLimitsResponse = () => { if (isMounted()) setLoading(false); @@ -84,13 +83,8 @@ const AccountLimits = observer( if (is_virtual) { return ( -
- +
+
); } diff --git a/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx b/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx index 1a30c4cc71a6..22a60c2cb878 100644 --- a/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx +++ b/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { BrowserRouter } from 'react-router-dom'; import { render, screen } from '@testing-library/react'; -import { PlatformContext } from '@deriv/shared'; import { MissingPersonalDetails } from '../missing-personal-details'; jest.mock('@deriv/components', () => { @@ -13,12 +12,7 @@ jest.mock('@deriv/components', () => { }); describe('', () => { - const renderWithRouter = component => - render( - - {component} - - ); + const renderWithRouter = component => render({component}); it('should render the MissingPersonalDetails component', () => { renderWithRouter(); @@ -52,7 +46,7 @@ describe('', () => { expect( screen.getByText(/please complete your personal details before you verify your identity\./i) ).toBeInTheDocument(); - expect(screen.getByText('IcAccountMissingDetailsDashboard')).toBeInTheDocument(); + expect(screen.getByText('IcAccountMissingDetails')).toBeInTheDocument(); const btn = screen.getByRole('link', { name: /go to personal details/i }); expect(btn).toBeInTheDocument(); @@ -62,11 +56,9 @@ describe('', () => { it('should show missing msg with proper icon if has_invalid_postal_code is false and is_appstore is false', () => { render( - - - - - + + + ); expect(screen.getByText(/your personal details are missing/i)).toBeInTheDocument(); diff --git a/packages/account/src/Components/poi/missing-personal-details/missing-personal-details.tsx b/packages/account/src/Components/poi/missing-personal-details/missing-personal-details.tsx index 2bac32dffd70..1ff0bcea9425 100644 --- a/packages/account/src/Components/poi/missing-personal-details/missing-personal-details.tsx +++ b/packages/account/src/Components/poi/missing-personal-details/missing-personal-details.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { PlatformContext } from '@deriv/shared'; import { ButtonLink, Icon, Text } from '@deriv/components'; import { localize } from '@deriv/translations'; import IconMessageContent from '../../icon-message-content'; @@ -24,7 +23,6 @@ const GoToPersonalDetailsButton = ({ anchor, from, text }: TGoToPersonalDetailsB }; export const MissingPersonalDetails = ({ has_invalid_postal_code, from }: TGoToPersonalDetailsButton) => { - const { is_appstore } = React.useContext(PlatformContext); if (has_invalid_postal_code) return ( - } + icon={} > diff --git a/packages/account/src/Components/poi/status/upload-complete/__tests__/upload-complete.spec.tsx b/packages/account/src/Components/poi/status/upload-complete/__tests__/upload-complete.spec.tsx index d6225d9e7c56..aa2fcdc3b569 100644 --- a/packages/account/src/Components/poi/status/upload-complete/__tests__/upload-complete.spec.tsx +++ b/packages/account/src/Components/poi/status/upload-complete/__tests__/upload-complete.spec.tsx @@ -1,7 +1,6 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import { Button } from '@deriv/components'; -import { PlatformContext } from '@deriv/shared'; import { UploadComplete } from '../upload-complete'; import { BrowserRouter } from 'react-router-dom'; @@ -23,21 +22,16 @@ describe('', () => { const redirect_button = ; const needs_poa_extra_submit_message = /you must also submit a proof of address./i; - const renderWithRouter = (component, is_appstore) => - render( - - {component} - - ); + const renderWithRouter = component => render({component}); it('should display Icon if is_appstore is false', () => { - renderWithRouter(, false); + renderWithRouter(); expect(screen.getByTestId(/dt_mocked_icon/)).toBeInTheDocument(); }); it('should render component for manual upload', () => { - renderWithRouter(, true); + renderWithRouter(); expect(screen.getByText(successful_upload_message)).toBeInTheDocument(); expect(screen.getByText(poi_under_review_message_for_manual)).toBeInTheDocument(); @@ -45,7 +39,7 @@ describe('', () => { expect(screen.queryByRole('button')).not.toBeInTheDocument(); }); it('should render component for manual upload', () => { - renderWithRouter(, true); + renderWithRouter(); expect(screen.getByText(successful_upload_message)).toBeInTheDocument(); expect(screen.getByText(poi_under_review_message_for_manual)).toBeInTheDocument(); @@ -54,19 +48,19 @@ describe('', () => { }); it('should not show redirect_button if it redirect_button passed and is_from_external is true, but needs_poa is false', () => { - renderWithRouter(, true); + renderWithRouter(); expect(screen.queryByRole('button')).not.toBeInTheDocument(); }); it('should show redirect button if needs_poa and is_from_external are false and have redirect button', () => { - renderWithRouter(, true); + renderWithRouter(); expect(screen.getByRole('button')).toBeInTheDocument(); }); it('should show needs_poa review message and extra submission message, and poa_buttons', () => { - renderWithRouter(, true); + renderWithRouter(); expect(screen.getByTestId('dt_poa_button')).toBeInTheDocument(); expect(screen.getByText(poi_under_review_message)).toBeInTheDocument(); @@ -75,7 +69,7 @@ describe('', () => { }); it('should show needs_poa review message and extra submission message, and poa_buttons but redirect_button will not display', () => { - renderWithRouter(, true); + renderWithRouter(); expect(screen.getByTestId('dt_poa_button')).toBeInTheDocument(); expect(screen.getByText(poi_under_review_message)).toBeInTheDocument(); diff --git a/packages/account/src/Components/poi/status/upload-complete/upload-complete.tsx b/packages/account/src/Components/poi/status/upload-complete/upload-complete.tsx index a483e233eb70..137aa203497a 100644 --- a/packages/account/src/Components/poi/status/upload-complete/upload-complete.tsx +++ b/packages/account/src/Components/poi/status/upload-complete/upload-complete.tsx @@ -1,11 +1,11 @@ import React from 'react'; import { Icon, Text } from '@deriv/components'; -import { PlatformContext, isNavigationFromP2P, isNavigationFromDerivGO } from '@deriv/shared'; +import { isNavigationFromP2P, isNavigationFromDerivGO } from '@deriv/shared'; import { localize } from '@deriv/translations'; import PoaButton from '../../../poa/poa-button'; import { ContinueTradingButton } from '../../../poa/continue-trading-button/continue-trading-button'; import IconMessageContent from '../../../icon-message-content/icon-message-content'; -import { TPlatformContext, TPOIStatus } from 'Types'; +import { TPOIStatus } from 'Types'; import classNames from 'classnames'; export const UploadComplete = ({ @@ -14,7 +14,6 @@ export const UploadComplete = ({ is_from_external, is_manual_upload = false, }: TPOIStatus) => { - const { is_appstore } = React.useContext(PlatformContext); const message = localize('Your documents were submitted successfully'); const description = is_manual_upload ? localize('We’ll review your documents and notify you of its status within 1 - 3 working days.') @@ -24,40 +23,19 @@ export const UploadComplete = ({ if (!needs_poa) { return ( - - ) : ( - - ) - } - className={classNames({ 'account-management-dashboard': is_appstore })} - > + }> {!is_from_external && (redirect_button || (!is_redirected_from_platform && ))} ); } return ( - - ) : ( - - ) - } - className={classNames({ 'account-management-dashboard': is_appstore })} - > + }>
- + {description} - + {localize('You must also submit a proof of address.')}
diff --git a/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-article.spec.tsx b/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-article.spec.tsx index ad68ca185397..611a509e5d44 100644 --- a/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-article.spec.tsx +++ b/packages/account/src/Components/self-exclusion/__tests__/self-exclusion-article.spec.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { PlatformContext } from '@deriv/shared'; import { fireEvent, render, screen } from '@testing-library/react'; import SelfExclusionArticle from '../self-exclusion-article'; import { selfExclusionArticleItems } from 'Components/self-exclusion/self-exclusion-article-content'; @@ -12,10 +11,6 @@ jest.mock('Components/self-exclusion/self-exclusion-article-content', () => ({ })); describe('', () => { - let mock_platform_context = { - is_appstore: false, - is_deriv_crypto: false, - }; let mock_self_exclusion_context = { is_app_settings: false, is_eu: false, @@ -32,10 +27,6 @@ describe('', () => { /these self-exclusion limits help you control the amount of money and time you spend trading on deriv trader, deriv bot, smarttrader and binary bot on deriv. the limits you set here will help you exercise/i; beforeEach(() => { - mock_platform_context = { - is_appstore: false, - is_deriv_crypto: false, - }; mock_self_exclusion_context = { is_app_settings: false, is_eu: false, @@ -59,11 +50,9 @@ describe('', () => { render( - - - - - + + + ); @@ -83,11 +72,9 @@ describe('', () => { render( - - - - - + + + ); @@ -106,11 +93,9 @@ describe('', () => { render( - - - - - + + + ); @@ -130,11 +115,9 @@ describe('', () => { render( - - - - - + + + ); diff --git a/packages/account/src/Components/self-exclusion/self-exclusion-article-content.tsx b/packages/account/src/Components/self-exclusion/self-exclusion-article-content.tsx index a5fcddd5eb65..ebf646a8e62c 100644 --- a/packages/account/src/Components/self-exclusion/self-exclusion-article-content.tsx +++ b/packages/account/src/Components/self-exclusion/self-exclusion-article-content.tsx @@ -1,21 +1,18 @@ import classNames from 'classnames'; import * as React from 'react'; import PropTypes from 'prop-types'; -import { getStaticUrl, PlatformContext } from '@deriv/shared'; +import { getStaticUrl } from '@deriv/shared'; import { Localize, localize } from '@deriv/translations'; import { Button, Icon, Popup, Text } from '@deriv/components'; import SelfExclusionContext from './self-exclusion-context'; -type TSelfExclusionArticleItems = Record< - 'is_eu' | 'is_uk' | 'is_deriv_crypto' | 'is_app_settings', - boolean | undefined ->; +type TSelfExclusionArticleItems = Record<'is_eu' | 'is_uk' | 'is_app_settings', boolean | undefined>; type TSelfExclusionArticleContent = { is_in_overlay: boolean; }; -export const selfExclusionArticleItems = ({ is_eu, is_deriv_crypto, is_app_settings }: TSelfExclusionArticleItems) => { +export const selfExclusionArticleItems = ({ is_eu, is_app_settings }: TSelfExclusionArticleItems) => { const getEuItems = () => { const eu_items = [ { @@ -28,7 +25,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_deriv_crypto, is_app_setti className='link' rel='noopener noreferrer' target='_blank' - href={getStaticUrl('/responsible', { is_deriv_crypto })} + href={getStaticUrl('/responsible')} />, ]} /> @@ -60,7 +57,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_deriv_crypto, is_app_setti className='link' rel='noopener noreferrer' target='_blank' - href={getStaticUrl('/contact_us', { is_deriv_crypto })} + href={getStaticUrl('/contact_us')} />, ]} /> @@ -82,7 +79,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_deriv_crypto, is_app_setti className='link' rel='noopener noreferrer' target='_blank' - href={getStaticUrl('/responsible', { is_deriv_crypto })} + href={getStaticUrl('/responsible')} />, ]} /> @@ -113,7 +110,7 @@ export const selfExclusionArticleItems = ({ is_eu, is_deriv_crypto, is_app_setti className='link' rel='noopener noreferrer' target='_blank' - href={getStaticUrl('/contact_us', { is_deriv_crypto })} + href={getStaticUrl('/contact_us')} />, ]} /> @@ -132,9 +129,8 @@ export const selfExclusionArticleItems = ({ is_eu, is_deriv_crypto, is_app_setti const SelfExclusionArticleContent = ({ is_in_overlay }: Partial) => { const { is_app_settings, toggleArticle, overlay_ref, is_eu, is_uk } = React.useContext(SelfExclusionContext); - const { is_deriv_crypto } = React.useContext(PlatformContext); - const keyed_article_items = selfExclusionArticleItems({ is_eu, is_uk, is_deriv_crypto, is_app_settings }); + const keyed_article_items = selfExclusionArticleItems({ is_eu, is_uk, is_app_settings }); if (is_in_overlay) { return ( { const { is_tablet, session_duration_digits } = React.useContext(SelfExclusionContext); const { errors, handleBlur, handleChange, setFieldValue, values }: TFormikContext = useFormikContext(); - const { is_appstore } = React.useContext(PlatformContext); return ( - } - has_border_line={is_appstore} - /> + } />
@@ -286,14 +282,10 @@ const SessionAndLoginLimitsInputs = () => { const MaximumAccountBalanceAndOpenPositionsInputs = () => { const { currency_display, getMaxLength } = React.useContext(SelfExclusionContext); const { errors, handleBlur, handleChange, values }: TFormikContext = useFormikContext(); - const { is_appstore } = React.useContext(PlatformContext); return ( - } - has_border_line={is_appstore} - /> + } />
@@ -345,7 +337,6 @@ const MaximumAccountBalanceAndOpenPositionsInputs = () => { const MaximumDepositLimitInputs = () => { const { currency, is_mf, getMaxLength } = React.useContext(SelfExclusionContext); const { errors, handleBlur, handleChange, values }: TFormikContext = useFormikContext(); - const { is_appstore } = React.useContext(PlatformContext); if (!is_mf) { return null; @@ -353,10 +344,7 @@ const MaximumDepositLimitInputs = () => { return ( - } - has_border_line={is_appstore} - /> + } />

@@ -436,13 +424,12 @@ const MaximumDepositLimitInputs = () => { }; const SelfExclusionInputs = () => { - const { is_appstore } = React.useContext(PlatformContext); const { footer_ref, goToConfirm, is_app_settings } = React.useContext(SelfExclusionContext); const { dirty, isSubmitting, isValid, values }: TFormikContext = useFormikContext(); const versions: Record }> = { // Global settings for account for DWallet. dwallet: { - condition: !!is_appstore, + condition: false, components: [ SessionAndLoginLimitsInputs, MaximumAccountBalanceAndOpenPositionsInputs, @@ -457,7 +444,7 @@ const SelfExclusionInputs = () => { }, // Legacy Deriv.app, i.e. non-DWallet user accessing app.deriv.com/account/self-exclusion. deriv_app: { - condition: !!(!is_appstore && !is_app_settings), + condition: !!(true && !is_app_settings), components: [ StakeLossAndLimitsInputs, SessionAndLoginLimitsInputs, diff --git a/packages/account/src/Sections/Security/AccountClosed/account-closed.tsx b/packages/account/src/Sections/Security/AccountClosed/account-closed.tsx index 1547cd86586e..c73992325596 100644 --- a/packages/account/src/Sections/Security/AccountClosed/account-closed.tsx +++ b/packages/account/src/Sections/Security/AccountClosed/account-closed.tsx @@ -2,22 +2,21 @@ import React from 'react'; import { Modal, Text } from '@deriv/components'; import { Localize } from '@deriv/translations'; import { observer, useStore } from '@deriv/stores'; -import { getStaticUrl, PlatformContext } from '@deriv/shared'; +import { getStaticUrl } from '@deriv/shared'; const AccountClosed = observer(() => { const { client } = useStore(); const { logout } = client; const [is_modal_open, setModalState] = React.useState(true); const [timer, setTimer] = React.useState(10); - const { is_appstore } = React.useContext(PlatformContext); const counter = React.useCallback(() => { if (timer > 0) { setTimer(timer - 1); } else { - window.location.href = getStaticUrl('/', { is_appstore }); + window.location.href = getStaticUrl('/'); } - }, [is_appstore, timer]); + }, [timer]); React.useEffect(() => { window.history.pushState(null, '', '/'); diff --git a/packages/cfd/src/Components/Routes/binary-link.jsx b/packages/cfd/src/Components/Routes/binary-link.jsx index c92428bdea66..a50bc31c95f4 100644 --- a/packages/cfd/src/Components/Routes/binary-link.jsx +++ b/packages/cfd/src/Components/Routes/binary-link.jsx @@ -1,14 +1,12 @@ import PropTypes from 'prop-types'; import React from 'react'; import { NavLink } from 'react-router-dom'; -import { PlatformContext } from '@deriv/shared'; import getRoutesConfig from '../../Constants/routes-config'; import { findRouteByPath, normalizePath } from './helpers'; const BinaryLink = ({ active_class, to, children, ...props }) => { - const { is_dashboard } = React.useContext(PlatformContext); const path = normalizePath(to); - const route = findRouteByPath(path, getRoutesConfig({ is_dashboard })); + const route = findRouteByPath(path, getRoutesConfig()); if (!route) { throw new Error(`Route not found: ${to}`); diff --git a/packages/cfd/src/Components/Routes/binary-routes.jsx b/packages/cfd/src/Components/Routes/binary-routes.jsx index a75cc6de0f81..2572f1c13fe8 100644 --- a/packages/cfd/src/Components/Routes/binary-routes.jsx +++ b/packages/cfd/src/Components/Routes/binary-routes.jsx @@ -1,13 +1,10 @@ import React from 'react'; import { Switch } from 'react-router-dom'; -import { PlatformContext } from '@deriv/shared'; import { Localize } from '@deriv/translations'; import getRoutesConfig from '../../Constants/routes-config'; import RouteWithSubRoutes from './route-with-sub-routes.jsx'; const BinaryRoutes = props => { - const { is_dashboard } = React.useContext(PlatformContext); - return ( { @@ -19,7 +16,7 @@ const BinaryRoutes = props => { }} > - {getRoutesConfig({ is_dashboard }).map(route => ( + {getRoutesConfig().map(route => ( ))} diff --git a/packages/components/src/components/send-email-template/send-email-template.tsx b/packages/components/src/components/send-email-template/send-email-template.tsx index e3273b37337d..7ce7286503b8 100644 --- a/packages/components/src/components/send-email-template/send-email-template.tsx +++ b/packages/components/src/components/send-email-template/send-email-template.tsx @@ -1,6 +1,5 @@ import React from 'react'; import classNames from 'classnames'; -import { PlatformContext } from '@deriv/shared'; import Icon from '../icon/icon'; import Button from '../button/button'; import Text from '../text'; @@ -32,7 +31,6 @@ const SendEmailTemplate = ({ const [is_email_not_received_clicked, setIsEmailNotReceivedClicked] = React.useState(false); const [is_resend_btn_disabled, setIsResendBtnDisabled] = React.useState(false); const [resend_email_btn_text, setResendEmailBtnText] = React.useState(txt_resend); - const { is_appstore }: { is_appstore: boolean } = React.useContext(PlatformContext); const timeout_limit = resend_timeout || 60; let resend_interval: number; @@ -70,13 +68,9 @@ const SendEmailTemplate = ({ }; return ( -
+
- + {title} diff --git a/packages/components/src/components/static-url/static-url.tsx b/packages/components/src/components/static-url/static-url.tsx index 849f3ea72599..ebceaafc3f4e 100644 --- a/packages/components/src/components/static-url/static-url.tsx +++ b/packages/components/src/components/static-url/static-url.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { getStaticUrl, PlatformContext, setUrlLanguage } from '@deriv/shared'; +import { getStaticUrl, setUrlLanguage } from '@deriv/shared'; import { getLanguage } from '@deriv/translations'; type TStaticUrl = React.HTMLAttributes & { @@ -9,10 +9,9 @@ type TStaticUrl = React.HTMLAttributes & { }; const StaticUrl = ({ href, is_document, is_eu_url = false, children = null, ...props }: TStaticUrl) => { - const { is_appstore }: { is_appstore: boolean } = React.useContext(PlatformContext); const getHref = () => { setUrlLanguage(getLanguage()); - return getStaticUrl(href, { is_appstore }, is_document, is_eu_url); + return getStaticUrl(href, is_document, is_eu_url); }; return ( diff --git a/packages/components/stories/icon/icons.js b/packages/components/stories/icon/icons.js index b8917a0f9b4e..8e884054e918 100644 --- a/packages/components/stories/icon/icons.js +++ b/packages/components/stories/icon/icons.js @@ -32,6 +32,7 @@ export const icons = 'IcAppstoreSuccess', 'IcAppstoreTickWhite', 'IcAppstoreTick', + 'IcAppstoreTradersHubHomeUpdated', 'IcAppstoreTradersHubHome', 'IcAppstoreTradingHubBeta', 'IcAppstoreTradingHubOnboardingDark', @@ -664,6 +665,7 @@ export const icons = 'IcWip', 'IcWithdrawRequestVerificationSent', 'IcWithdrawRequestVerification', + 'IcX', 'IcZingpay', 'IcZoomIn', 'IcZoomOut', @@ -746,6 +748,7 @@ export const icons = 'IcFlagPl', 'IcFlagPt', 'IcFlagRu', + 'IcFlagSi', 'IcFlagTh', 'IcFlagTr', 'IcFlagUk', diff --git a/packages/components/stories/static-url/README.md b/packages/components/stories/static-url/README.md index 1255b49db742..0eac6558e90d 100644 --- a/packages/components/stories/static-url/README.md +++ b/packages/components/stories/static-url/README.md @@ -1,34 +1,34 @@ # StaticUrl component + Use this component to generate a link to 'deriv.com'. -We need 'PlatformContext' provider's value from the application state. #### Supported events: + All events supported for an '\' tag. ## Usage - + ```jsx import { StaticUrl } from 'deriv-components'; -const DummyComponent = (props) => ( - Static Url link. -); +const DummyComponent = props => Static Url link.; ``` ## Props -| Name | Type | Default | Description | -|--------------------------|------------------------|--------------------|--------------------------------------------------------------------------------------------------------------------------| -| href | {string} | null | Name of the static page on 'deriv.com' | -| is\_document | {boolean} | null | Set it to 'true' to get a normalized path for the link | - +| Name | Type | Default | Description | +| ----------- | --------- | ------- | ------------------------------------------------------ | +| href | {string} | null | Name of the static page on 'deriv.com' | +| is_document | {boolean} | null | Set it to 'true' to get a normalized path for the link | ## Full example: ```jsx import { SwipeableWrapper } from 'deriv-components'; -const DummyComponent = (props) => ( - Static Url link to a document. +const DummyComponent = props => ( + + Static Url link to a document. + ); ``` diff --git a/packages/components/stories/static-url/stories/basic.js b/packages/components/stories/static-url/stories/basic.js index 13a75fb2cad3..a04e1bf9acc4 100644 --- a/packages/components/stories/static-url/stories/basic.js +++ b/packages/components/stories/static-url/stories/basic.js @@ -1,17 +1,12 @@ import React from 'react'; -import { PlatformContext } from '@deriv/shared'; import { boolean } from '@storybook/addon-knobs'; import StaticUrl from 'Components/static-url'; import Wrapper from '../../shared/wrapper'; -const Provider = ({ children }) => {children}; - const Basic = () => ( - - - Link to the about page on deriv.com. - - + + Link to the about page on deriv.com. + ); export default Basic; diff --git a/packages/core/src/App/AppContent.tsx b/packages/core/src/App/AppContent.tsx index 49da72935cde..731846097e06 100644 --- a/packages/core/src/App/AppContent.tsx +++ b/packages/core/src/App/AppContent.tsx @@ -17,7 +17,6 @@ import AppContents from './Containers/Layout/app-contents.jsx'; import Footer from './Containers/Layout/footer.jsx'; import Header from './Containers/Layout/header'; import AppModals from './Containers/Modals'; -import PlatformContainer from './Containers/PlatformContainer/PlatformContainer.jsx'; import Routes from './Containers/Routes/routes.jsx'; import Devtools from './Devtools'; import initDatadog from '../Utils/Datadog'; @@ -84,7 +83,7 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough } }, [has_wallet, store.common, store.ui]); return ( - + <>
@@ -102,7 +101,7 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough } {is_next_wallet_enabled && } - + ); }); diff --git a/packages/core/src/App/Components/Elements/NotificationMessage/notification.jsx b/packages/core/src/App/Components/Elements/NotificationMessage/notification.jsx index d8bf46a9b187..9c3dd444e4e3 100644 --- a/packages/core/src/App/Components/Elements/NotificationMessage/notification.jsx +++ b/packages/core/src/App/Components/Elements/NotificationMessage/notification.jsx @@ -2,7 +2,7 @@ import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import { Button, LinearProgress, Text } from '@deriv/components'; -import { isEmptyObject, PlatformContext } from '@deriv/shared'; +import { isEmptyObject } from '@deriv/shared'; import CloseButton from './close-button.jsx'; import NotificationStatusIcons from './notification-status-icons.jsx'; import NotificationBanner from './notification-banner.jsx'; @@ -13,7 +13,6 @@ import NotificationOrder from './notification-order.jsx'; const Notification = ({ data, removeNotificationMessage }) => { const linear_progress_container_ref = React.useRef(null); - const { is_appstore } = React.useContext(PlatformContext); const destroy = is_closed_by_user => { removeNotificationMessage(data); @@ -138,7 +137,7 @@ const Notification = ({ data, removeNotificationMessage }) => { onClick={() => { if (data.timeout) linear_progress_container_ref.current.removeTimeoutSession(); - data.action.onClick({ is_appstore }); + data.action.onClick({ is_appstore: false }); }} text={data.action.text} secondary diff --git a/packages/core/src/App/Components/Layout/Header/account-actions.jsx b/packages/core/src/App/Components/Layout/Header/account-actions.jsx index e8627d2c32ee..d8165a0695a9 100644 --- a/packages/core/src/App/Components/Layout/Header/account-actions.jsx +++ b/packages/core/src/App/Components/Layout/Header/account-actions.jsx @@ -1,7 +1,7 @@ import * as PropTypes from 'prop-types'; import React from 'react'; import { Button, DesktopWrapper, Icon, MobileWrapper, Popover } from '@deriv/components'; -import { routes, formatMoney, PlatformContext, moduleLoader } from '@deriv/shared'; +import { routes, formatMoney, moduleLoader } from '@deriv/shared'; import { localize, Localize } from '@deriv/translations'; import { LoginButton } from './login-button.jsx'; import { SignupButton } from './signup-button.jsx'; @@ -38,8 +38,6 @@ const AccountActions = React.memo( toggleAccountsDialog, toggleNotifications, }) => { - const { is_appstore } = React.useContext(PlatformContext); - if (is_logged_in) { return ( @@ -131,7 +129,7 @@ const AccountActions = React.memo( return ( - + ); } diff --git a/packages/core/src/App/Components/Routes/binary-link.jsx b/packages/core/src/App/Components/Routes/binary-link.jsx index 5aa149160698..e1bcc52dcb85 100644 --- a/packages/core/src/App/Components/Routes/binary-link.jsx +++ b/packages/core/src/App/Components/Routes/binary-link.jsx @@ -2,7 +2,6 @@ import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import { NavLink } from 'react-router-dom'; -import { PlatformContext } from '@deriv/shared'; import { findRouteByPath, normalizePath } from './helpers'; import getRoutesConfig from '../../Constants/routes-config'; import { observer, useStore } from '@deriv/stores'; @@ -11,13 +10,11 @@ import { observer, useStore } from '@deriv/stores'; // when binary link is imported into components present in routes config // or into their descendants const BinaryLink = observer(({ active_class, to, children, href, ...props }) => { - const platform_context = React.useContext(PlatformContext); const { common } = useStore(); const { has_error, error } = common; const setError = error.setError; - const is_appstore = platform_context?.is_appstore; const path = normalizePath(to); - const route = findRouteByPath(path, getRoutesConfig({ is_appstore })); + const route = findRouteByPath(path, getRoutesConfig({ is_appstore: false })); if (!route && to) { throw new Error(`Route not found: ${to}`); diff --git a/packages/core/src/App/Components/Routes/binary-routes.jsx b/packages/core/src/App/Components/Routes/binary-routes.jsx index 0606e75d7ba2..63837ca30547 100644 --- a/packages/core/src/App/Components/Routes/binary-routes.jsx +++ b/packages/core/src/App/Components/Routes/binary-routes.jsx @@ -1,7 +1,6 @@ import React from 'react'; import { Switch, Prompt, useLocation } from 'react-router-dom'; import { Loading } from '@deriv/components'; -import { PlatformContext } from '@deriv/shared'; import getRoutesConfig from 'App/Constants/routes-config'; import RouteWithSubRoutes from './route-with-sub-routes.jsx'; import { observer, useStore } from '@deriv/stores'; @@ -12,7 +11,6 @@ const BinaryRoutes = observer(props => { const { pushDataLayer } = gtm; const { is_eu } = client; const location = useLocation(); - const { is_appstore } = React.useContext(PlatformContext); React.useEffect(() => { pushDataLayer({ event: 'page_load' }); // eslint-disable-next-line react-hooks/exhaustive-deps @@ -24,7 +22,7 @@ const BinaryRoutes = observer(props => { }> - {getRoutesConfig({ is_appstore, is_eu_country }).map((route, idx) => ( + {getRoutesConfig({ is_appstore: false, is_eu_country }).map((route, idx) => ( ))} diff --git a/packages/core/src/App/Containers/Layout/app-contents.jsx b/packages/core/src/App/Containers/Layout/app-contents.jsx index 6fdbbf1c1225..2a2327d97862 100644 --- a/packages/core/src/App/Containers/Layout/app-contents.jsx +++ b/packages/core/src/App/Containers/Layout/app-contents.jsx @@ -4,7 +4,7 @@ import React from 'react'; import { useLocation, withRouter } from 'react-router'; import { Analytics } from '@deriv-com/analytics'; import { DesktopWrapper, MobileWrapper, ThemedScrollbars } from '@deriv/components'; -import { CookieStorage, isMobile, TRACKING_STATUS_KEY, PlatformContext, platforms, routes, WS } from '@deriv/shared'; +import { CookieStorage, isMobile, TRACKING_STATUS_KEY, platforms, routes, WS } from '@deriv/shared'; import { useStore, observer } from '@deriv/stores'; import CookieBanner from '../../Components/Elements/CookieBanner/cookie-banner.jsx'; @@ -13,7 +13,6 @@ const tracking_status_cookie = new CookieStorage(TRACKING_STATUS_KEY); const AppContents = observer(({ children }) => { const [show_cookie_banner, setShowCookieBanner] = React.useState(false); const [is_gtm_tracking, setIsGtmTracking] = React.useState(false); - const { is_appstore } = React.useContext(PlatformContext); const { client, common: { platform }, @@ -108,7 +107,6 @@ const AppContents = observer(({ children }) => { 'app-contents--is-mobile': isMobile(), 'app-contents--is-route-modal': is_route_modal_on, 'app-contents--is-scrollable': is_cfd_page || is_cashier_visible, - 'app-contents--is-dashboard': is_appstore, 'app-contents--is-hidden': platforms[platform], 'app-contents--is-onboarding': window.location.pathname === routes.onboarding, })} diff --git a/packages/core/src/App/Containers/PlatformContainer/PlatformContainer.jsx b/packages/core/src/App/Containers/PlatformContainer/PlatformContainer.jsx deleted file mode 100644 index 2fd0ca27eadd..000000000000 --- a/packages/core/src/App/Containers/PlatformContainer/PlatformContainer.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { PlatformContext } from '@deriv/shared'; - -const DERIV_APPSTORE_KEY = 'is_appstore'; - -// TODO: remove 'is_appstore' as it is deprecated -const PlatformContainer = props => { - // TODO: set is_appstore based on a flag from BE. - const is_appstore_storage = window.localStorage.getItem(DERIV_APPSTORE_KEY) === 'true'; - const [is_appstore, setIsAppStore] = React.useState(is_appstore_storage); - - const platform_store = { - is_appstore, - setIsAppStore, - DERIV_APPSTORE_KEY, - }; - - return ; -}; - -export default PlatformContainer; diff --git a/packages/core/src/App/Containers/PlatformContainer/index.js b/packages/core/src/App/Containers/PlatformContainer/index.js deleted file mode 100644 index 945ae73f3886..000000000000 --- a/packages/core/src/App/Containers/PlatformContainer/index.js +++ /dev/null @@ -1 +0,0 @@ -export default from './PlatformContainer.jsx'; diff --git a/packages/core/src/App/Containers/RealAccountSignup/modal-login-prompt.jsx b/packages/core/src/App/Containers/RealAccountSignup/modal-login-prompt.jsx index 018dac53bafd..169e0d60928e 100644 --- a/packages/core/src/App/Containers/RealAccountSignup/modal-login-prompt.jsx +++ b/packages/core/src/App/Containers/RealAccountSignup/modal-login-prompt.jsx @@ -1,12 +1,10 @@ import React from 'react'; import { Button, Text } from '@deriv/components'; import { getLanguage, localize } from '@deriv/translations'; -import { PlatformContext, redirectToLogin, redirectToSignUp } from '@deriv/shared'; +import { redirectToLogin, redirectToSignUp } from '@deriv/shared'; import 'Sass/modal-login-prompt.scss'; const ModalLoginPrompt = () => { - const { is_deriv_crypto } = React.useContext(PlatformContext); - return (
@@ -16,7 +14,11 @@ const ModalLoginPrompt = () => {
); diff --git a/packages/core/src/App/Containers/Redirect/redirect.jsx b/packages/core/src/App/Containers/Redirect/redirect.jsx index 043c581d6626..c23ef6b414d0 100644 --- a/packages/core/src/App/Containers/Redirect/redirect.jsx +++ b/packages/core/src/App/Containers/Redirect/redirect.jsx @@ -1,7 +1,6 @@ -import React from 'react'; import PropTypes from 'prop-types'; import { withRouter, useHistory } from 'react-router-dom'; -import { loginUrl, routes, redirectToLogin, SessionStore, PlatformContext } from '@deriv/shared'; +import { loginUrl, routes, redirectToLogin, SessionStore } from '@deriv/shared'; import { observer, useStore } from '@deriv/stores'; import { getLanguage } from '@deriv/translations'; import { WS } from 'Services'; @@ -30,7 +29,6 @@ const Redirect = observer(() => { const code_param = url_params.get('code') || verification_code[action_param]; const ext_platform_url = url_params.get('ext_platform_url'); const is_next_wallet = localStorage.getObject('FeatureFlagsStore')?.data?.next_wallet; - const { is_appstore } = React.useContext(PlatformContext); const redirectToExternalPlatform = url => { history.push(`${routes.root}?ext_platform_url=${url}`); @@ -41,13 +39,11 @@ const Redirect = observer(() => { switch (action_param) { case 'signup': { - if (!is_appstore) { - Analytics.trackEvent('ce_virtual_signup_form', { - action: 'email_confirmed', - form_name: is_mobile ? 'virtual_signup_web_mobile_default' : 'virtual_signup_web_desktop_default', - email: url_params.get('email'), - }); - } + Analytics.trackEvent('ce_virtual_signup_form', { + action: 'email_confirmed', + form_name: is_mobile ? 'virtual_signup_web_mobile_default' : 'virtual_signup_web_desktop_default', + email: url_params.get('email'), + }); SessionStore.set('signup_query_param', url_query_string); history.push({ pathname: routes.onboarding, diff --git a/packages/p2p/src/components/routes/__tests__/binary-routes.spec.tsx b/packages/p2p/src/components/routes/__tests__/binary-routes.spec.tsx index f3a94c4e7b14..aaf6ab5607bf 100644 --- a/packages/p2p/src/components/routes/__tests__/binary-routes.spec.tsx +++ b/packages/p2p/src/components/routes/__tests__/binary-routes.spec.tsx @@ -2,7 +2,6 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import { createBrowserHistory } from 'history'; import { Router } from 'react-router-dom'; -import { PlatformContext } from '@deriv/shared'; import { mockStore, StoreProvider } from '@deriv/stores'; import BinaryRoutes from '../binary-routes'; @@ -22,12 +21,7 @@ const wrapper = ({ children }: { children: JSX.Element }) => { const history = createBrowserHistory(); - return render( - - {component} - , - { wrapper } - ); + return render({component}, { wrapper }); }; describe('', () => { diff --git a/packages/shared/src/utils/platform/index.ts b/packages/shared/src/utils/platform/index.ts index 3fd7443e7d0f..1841b995c932 100644 --- a/packages/shared/src/utils/platform/index.ts +++ b/packages/shared/src/utils/platform/index.ts @@ -1,2 +1 @@ export * from './platform'; -export * from './platform-context'; diff --git a/packages/shared/src/utils/platform/platform-context.tsx b/packages/shared/src/utils/platform/platform-context.tsx deleted file mode 100644 index d25518206662..000000000000 --- a/packages/shared/src/utils/platform/platform-context.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; - -type TPlatformContext = { - is_appstore: boolean; - is_pre_appstore: boolean; - is_deriv_crypto: boolean; -}; - -export const PlatformContext = React.createContext({ - is_appstore: false, - is_pre_appstore: false, - is_deriv_crypto: false, -}); - -PlatformContext.displayName = 'DerivAppStorePlatformContext'; From 29f22760265ca9d8e80f15df492a1c4e0c994501 Mon Sep 17 00:00:00 2001 From: Muhammad Fasih Ali Naqvi Date: Fri, 3 May 2024 13:19:46 +0800 Subject: [PATCH 02/10] chore: removed unused code --- packages/components/stories/icon/icons.js | 3 --- .../Components/Layout/Header/account-actions.jsx | 2 +- .../Components/Layout/Header/signup-button.jsx | 5 ++--- .../RealAccountSignup/modal-login-prompt.jsx | 6 +----- packages/shared/src/utils/login/login.ts | 9 ++------- .../authorization-required-modal.spec.tsx | 1 - .../authorization-required-modal.tsx | 15 ++------------- 7 files changed, 8 insertions(+), 33 deletions(-) diff --git a/packages/components/stories/icon/icons.js b/packages/components/stories/icon/icons.js index 8e884054e918..b8917a0f9b4e 100644 --- a/packages/components/stories/icon/icons.js +++ b/packages/components/stories/icon/icons.js @@ -32,7 +32,6 @@ export const icons = 'IcAppstoreSuccess', 'IcAppstoreTickWhite', 'IcAppstoreTick', - 'IcAppstoreTradersHubHomeUpdated', 'IcAppstoreTradersHubHome', 'IcAppstoreTradingHubBeta', 'IcAppstoreTradingHubOnboardingDark', @@ -665,7 +664,6 @@ export const icons = 'IcWip', 'IcWithdrawRequestVerificationSent', 'IcWithdrawRequestVerification', - 'IcX', 'IcZingpay', 'IcZoomIn', 'IcZoomOut', @@ -748,7 +746,6 @@ export const icons = 'IcFlagPl', 'IcFlagPt', 'IcFlagRu', - 'IcFlagSi', 'IcFlagTh', 'IcFlagTr', 'IcFlagUk', diff --git a/packages/core/src/App/Components/Layout/Header/account-actions.jsx b/packages/core/src/App/Components/Layout/Header/account-actions.jsx index d8165a0695a9..32c21d07044d 100644 --- a/packages/core/src/App/Components/Layout/Header/account-actions.jsx +++ b/packages/core/src/App/Components/Layout/Header/account-actions.jsx @@ -129,7 +129,7 @@ const AccountActions = React.memo( return ( - + ); } diff --git a/packages/core/src/App/Components/Layout/Header/signup-button.jsx b/packages/core/src/App/Components/Layout/Header/signup-button.jsx index d4ca8d1a177f..a4249ff75ce7 100644 --- a/packages/core/src/App/Components/Layout/Header/signup-button.jsx +++ b/packages/core/src/App/Components/Layout/Header/signup-button.jsx @@ -4,20 +4,19 @@ import { Button } from '@deriv/components'; import { redirectToSignUp } from '@deriv/shared'; import { localize } from '@deriv/translations'; -const SignupButton = ({ className, is_appstore }) => ( +const SignupButton = ({ className }) => (
); diff --git a/packages/shared/src/utils/login/login.ts b/packages/shared/src/utils/login/login.ts index 9a256d9da1ad..ac4c4653c19c 100644 --- a/packages/shared/src/utils/login/login.ts +++ b/packages/shared/src/utils/login/login.ts @@ -16,13 +16,8 @@ export const redirectToLogin = (is_logged_in: boolean, language: string, has_par } }; -type TRedirectToSignUp = { - is_appstore?: boolean; - is_deriv_crypto?: boolean; -}; - -export const redirectToSignUp = ({ is_appstore }: TRedirectToSignUp = {}) => { - window.open(getStaticUrl('/signup/', { is_appstore })); +export const redirectToSignUp = () => { + window.open(getStaticUrl('/signup/')); }; type TLoginUrl = { diff --git a/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/__tests__/authorization-required-modal.spec.tsx b/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/__tests__/authorization-required-modal.spec.tsx index 795173213716..d76e2543eb27 100644 --- a/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/__tests__/authorization-required-modal.spec.tsx +++ b/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/__tests__/authorization-required-modal.spec.tsx @@ -50,7 +50,6 @@ describe('', () => { is_visible: true, toggleModal: jest.fn(), is_logged_in: true, - is_appstore: true, }; it('modal title, modal description, log in button, and signup button to be rendered', () => { diff --git a/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/authorization-required-modal.tsx b/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/authorization-required-modal.tsx index 69779bab16ea..abda56e3a291 100644 --- a/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/authorization-required-modal.tsx +++ b/packages/trader/src/App/Components/Elements/Modals/ServicesErrorModal/authorization-required-modal.tsx @@ -6,16 +6,10 @@ import { redirectToLogin, redirectToSignUp } from '@deriv/shared'; type TAuthorizationRequiredModal = { is_visible: boolean; toggleModal: () => void; - is_appstore?: boolean; is_logged_in: boolean; }; -const AuthorizationRequiredModal = ({ - is_visible, - toggleModal, - is_appstore, - is_logged_in, -}: TAuthorizationRequiredModal) => ( +const AuthorizationRequiredModal = ({ is_visible, toggleModal, is_logged_in }: TAuthorizationRequiredModal) => ( redirectToLogin(is_logged_in, getLanguage())} secondary /> -